40 #ifndef USE_TRUE_64BIT 50 U32BIT t = variable.l;
52 variable.l += value.l;
58 variable.h += value.h;
70 U32BIT t = variable.l;
93 c = (value.l > variable.l);
94 variable.l -= value.l;
95 variable.h -= value.h;
112 c = (value > variable.l);
126 U32BIT t0, t1, t2, t3, t4, t5, t6, c, hw;
127 U16BIT a0, a1, a2, a3;
147 a0 = variable.l & 0xffffU;
148 a1 = (variable.l >> 16) & 0xffffU;
149 a2 = variable.h & 0xffffU;
150 a3 = (variable.h >> 16) & 0xffffU;
151 b0 = value & 0xffffU;
152 b1 = (value >> 16) & 0xffffU;
168 hw = (t1 << 16) & 0xffff0000U;
169 c += (variable.l + hw < variable.l);
171 hw = (t4 << 16) & 0xffff0000U;
172 c += (variable.l + hw < variable.l);
176 variable.l &= 0xffffffffU;
179 variable.h = (t1 >> 16) + t2 + (t3 << 16) + (t4 >> 16) + t5 + (t6 << 16) + c;
182 variable.h &= 0xffffffffU;
201 m = variable.h % value;
202 variable.h = (p - m) / value;
205 m = ((m << 8) | ((variable.l >> 24) & 0xff)) & 0xffffffffU;
208 acc = (p - m) / value;
210 m = ((m << 8) | ((variable.l >> 16) & 0xff)) & 0xffffffffU;
213 acc = acc * 256 + (p - m) / value;
215 m = ((m << 8) | ((variable.l >> 8) & 0xff)) & 0xffffffffU;
218 acc = acc * 256 + (p - m) / value;
220 m = ((m << 8) | (variable.l & 0xff)) & 0xffffffffU;
223 acc = acc * 256 + (p - m) / value;
246 variable.h = variable.l;
247 variable.h <<= value - 32;
252 c = variable.l >> (32 - value);
253 variable.h <<= value;
255 variable.l <<= value;
276 variable.l = variable.h;
277 variable.l >>= value - 32;
282 c = variable.h << (32 - value);
283 variable.l >>= value;
285 variable.h >>= value;
303 acc = variable.h % value;
304 acc = (acc << 8 | ((variable.l >> 24) & 0xff)) % value;
305 acc = (acc << 8 | ((variable.l >> 16) & 0xff)) % value;
306 acc = (acc << 8 | ((variable.l >> 8) & 0xff)) % value;
307 acc = (acc << 8 | (variable.l & 0xff)) % value;
328 if (first.h > second.h)
332 else if (first.h == second.h)
334 if (first.l > second.l)
338 else if (first.l == second.l)
375 else if (variable.l > value)
379 else if (variable.l == value)
404 if (*str >=
'0' && *str <=
'9')
406 variable.l = *str -
'0';
410 while (*str >=
'0' && *str <=
'9')
429 char local[MAX_64BIT_DECIMAL_STRING];
433 if (variable.l == 0 && variable.h == 0)
444 while (tmp.l != 0 || tmp.h != 0)
447 local[p] =
'0' + (6 * (tmp.h % 10) + (tmp.l % 10)) % 10;
478 if (*str >=
'0' && *str <=
'9')
480 variable = *str -
'0';
483 while (*str >=
'0' && *str <=
'9')
486 variable += *str -
'0';
502 char local[MAX_64BIT_DECIMAL_STRING];
515 while (variable != 0)
517 local[p] =
'0' + variable % 10;
S32BIT ULONG_Compare32(U64BIT variable, U32BIT value)
Compare a variable with a 32-bit value, returning a value that indicates the result of the comparison...
U64BIT ULONG_ShiftRight(U64BIT variable, U32BIT value)
Shift bits right on unsigned 64 bit variable by a 32-bit value.
S32BIT ULONG_Compare(U64BIT first, U64BIT second)
Compare two variables, returning a value that indicates the result of the comparison.
U64BIT ULONG_ShiftLeft(U64BIT variable, U32BIT value)
Shift bits left on unsigned 64 bit variable by a 32-bit value.
U64BIT ULONG_Sub32(U64BIT variable, U32BIT value)
Subtract a 32-bit value from a unsigned 64 bit variable. It is the responsibility of the caller to ma...
U64BIT ULONG_Sub(U64BIT variable, U64BIT value)
Subtract a value from a unsigned 64 bit variable. It is the responsibility of the caller to make sure...
U64BIT ULONG_Div32(U64BIT variable, U32BIT value)
Divide a unsigned 64 bit variable by a 24-bit value. NOTE: This function will produce invalid values ...
U64BIT ULONG_Add(U64BIT variable, U64BIT value)
Add a value to a unsigned 64 bit variable.
U64BIT ULONG_Atoi(char *str)
Convert a string to a unsigned 64 bit. Only the numeric part of the string is converted (up to the fi...
U64BIT ULONG_Add32(U64BIT variable, U32BIT value)
Add a 32-bit value to a unsigned 64 bit variable.
U32BIT ULONG_Mod32(U64BIT variable, U32BIT value)
Find the remainer after dividing a unsigned 64 bit variable by a 24-bit value. NOTE: This function wi...
void ULONG_Itoa(U64BIT variable, char *str)
Convert a unsigned 64 bit to a string. The string should be able to hold at least 21 characters...
U64BIT ULONG_Mul32(U64BIT variable, U32BIT value)
Multiply a unsigned 64 bit variable by a 32-bit value.