2 * Handling of the int64 and uint64 types. Done in 32-bit integers,
3 * for (pre-C99) portability. Hopefully once C99 becomes widespread
4 * we can kiss this lot goodbye...
13 uint64 uint64_div10(uint64 x, int *remainder)
21 * Now we have to add in the remainder left over from x.hi.
24 y.lo += r2 * 2 * (0x80000000 / 10);
25 rem += r2 * 2 * (0x80000000 % 10);
34 void uint64_decimal(uint64 x, char *buffer)
40 while (x.hi || x.lo) {
41 x = uint64_div10(x, &d);
43 buf[--start] = d + '0';
46 memcpy(buffer, buf + start, sizeof(buf) - start);
47 buffer[sizeof(buf) - start] = '\0';
50 uint64 uint64_make(unsigned long hi, unsigned long lo)
58 uint64 uint64_add(uint64 x, uint64 y)
61 x.hi += y.hi + (x.lo < y.lo ? 1 : 0);
65 uint64 uint64_add32(uint64 x, unsigned long y)
70 return uint64_add(x, yy);