parsav  Diff

Differences From Artifact [bc01716315]:

To Artifact [1d1d177061]:


184
185
186
187
188
189
190


















191
192
193
194
195
196
197
		else dgtct = dgtct + 1 end
	end else
		buf = buf - 1
		@buf = 0x30
	end
	return buf
end



















terra m.ndigits(n: intptr, base: intptr): intptr
	var c = base
	var i = 1
	while true do
		if n < c then return i end
		c = c * base







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
		else dgtct = dgtct + 1 end
	end else
		buf = buf - 1
		@buf = 0x30
	end
	return buf
end

terra m.decparse(s: pstring): {intptr, bool}
	if not s then return 0, false end
	var val:intptr = 0
	var c = s.ptr
	while @c ~= 0 do
		if @c >= 0x30 and @c <= 0x39 then
			val = val * 10
			val = val + (@c - 0x30)
		else
			return 0, false
		end

		c = c + 1
		if s.ct ~= 0 and (c - s.ptr > s.ct) then lib.dbg('reached end') return val, true end
	end
	return val, true
end

terra m.ndigits(n: intptr, base: intptr): intptr
	var c = base
	var i = 1
	while true do
		if n < c then return i end
		c = c * base