util  Diff

Differences From Artifact [aa1f140ed9]:

To Artifact [1556b70bdd]:


225
226
227
228
229
230
231

232
233
234
235
236
237
238
239
240
241
242
243
244

	char* ptr = buf_end;

	if (base > maxbase) return bad_base;
	if (base == 0) return itoasc(val, buf_start, buf_end, newbuf);

	*ptr-- = 0;

	while(val > 0) {
		if (ptr < buf_start) return bad_overflow;
		word rem = val % base;
		val /= base;
		char out = baseref[rem];
		if (lowercase && base < imaxbase)
			if (out >= 'A' && out <= 'Z')
				out += ('a' - 'A');
		*ptr-- = out;
	}

	if (newbuf != null) *newbuf = ptr + 1;
	return ok;







>
|




|







225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245

	char* ptr = buf_end;

	if (base > maxbase) return bad_base;
	if (base == 0) return itoasc(val, buf_start, buf_end, newbuf);

	*ptr-- = 0;
	if (val == 0) *ptr-- = '0';
	else while(val > 0) {
		if (ptr < buf_start) return bad_overflow;
		word rem = val % base;
		val /= base;
		char out = baseref[rem];
		if (lowercase && base <= imaxbase)
			if (out >= 'A' && out <= 'Z')
				out += ('a' - 'A');
		*ptr-- = out;
	}

	if (newbuf != null) *newbuf = ptr + 1;
	return ok;