Kernel/arm7 - Tiny bugfix in NewKThread
[tpg/acess2.git] / Kernel / lib.c
index 83965cc..28edc56 100644 (file)
@@ -159,6 +159,7 @@ void itoa(char *buf, Uint64 num, int base, int minLength, char pad)
 {
        char    tmpBuf[64+1];
         int    pos=0, i;
+       Uint64  rem;
 
        // Sanity check
        if(!buf)        return;
@@ -171,11 +172,11 @@ void itoa(char *buf, Uint64 num, int base, int minLength, char pad)
        
        // Convert 
        while(num > base-1) {
-               tmpBuf[pos] = cUCDIGITS[ num % base ];
-               num /= (Uint)base;              // Shift `num` right 1 digit
+               num = DivMod64U(num, base, &rem);       // Shift `num` and get remainder
+               tmpBuf[pos] = cUCDIGITS[ rem ];
                pos++;
        }
-       tmpBuf[pos++] = cUCDIGITS[ num % base ];                // Last digit of `num`
+       tmpBuf[pos++] = cUCDIGITS[ num ];               // Last digit of `num`
        
        // Put in reverse
        i = 0;
@@ -908,7 +909,7 @@ int ModUtil_SetIdent(char *Dest, const char *Value)
 /**
  * \brief Convert a string of hexadecimal digits into a byte stream
  */
-int    UnHex(Uint8 *Dest, size_t DestSize, const char *SourceString)
+int UnHex(Uint8 *Dest, size_t DestSize, const char *SourceString)
 {
         int    i;
        

UCC git Repository :: git.ucc.asn.au