util  Diff

Differences From Artifact [aa1f140ed9]:

To Artifact [1556b70bdd]:


   225    225   
   226    226   	char* ptr = buf_end;
   227    227   
   228    228   	if (base > maxbase) return bad_base;
   229    229   	if (base == 0) return itoasc(val, buf_start, buf_end, newbuf);
   230    230   
   231    231   	*ptr-- = 0;
   232         -	while(val > 0) {
          232  +	if (val == 0) *ptr-- = '0';
          233  +	else while(val > 0) {
   233    234   		if (ptr < buf_start) return bad_overflow;
   234    235   		word rem = val % base;
   235    236   		val /= base;
   236    237   		char out = baseref[rem];
   237         -		if (lowercase && base < imaxbase)
          238  +		if (lowercase && base <= imaxbase)
   238    239   			if (out >= 'A' && out <= 'Z')
   239    240   				out += ('a' - 'A');
   240    241   		*ptr-- = out;
   241    242   	}
   242    243   
   243    244   	if (newbuf != null) *newbuf = ptr + 1;
   244    245   	return ok;