Differences From
Artifact [bc01716315]:
184 184 else dgtct = dgtct + 1 end
185 185 end else
186 186 buf = buf - 1
187 187 @buf = 0x30
188 188 end
189 189 return buf
190 190 end
191 +
192 +terra m.decparse(s: pstring): {intptr, bool}
193 + if not s then return 0, false end
194 + var val:intptr = 0
195 + var c = s.ptr
196 + while @c ~= 0 do
197 + if @c >= 0x30 and @c <= 0x39 then
198 + val = val * 10
199 + val = val + (@c - 0x30)
200 + else
201 + return 0, false
202 + end
203 +
204 + c = c + 1
205 + if s.ct ~= 0 and (c - s.ptr > s.ct) then lib.dbg('reached end') return val, true end
206 + end
207 + return val, true
208 +end
191 209
192 210 terra m.ndigits(n: intptr, base: intptr): intptr
193 211 var c = base
194 212 var i = 1
195 213 while true do
196 214 if n < c then return i end
197 215 c = c * base