25 #ifndef _GLUE_ULONG_H_
26 #define _GLUE_ULONG_H_
33 #if defined(ULONG_MAX) && ULONG_MAX > 0x7fffffff
35 #elif defined(LLONG_MAX) && LLONG_MAX > 0x7fffffff
44 typedef __int64 uint64_t;
45 #define atoll(s) atol(s)
57 #define MAX_64BIT_DECIMAL_STRING 22
60 #define INVALID_64BIT_VAL 0xffffffffffffffffULL
61 #define ULL_Get32(variable) ((U32BIT)variable)
62 #define ULL_Add(variable, value) variable += (value)
63 #define ULL_Add32(variable, value) variable += ((U64BIT)value)
64 #define ULL_Sub(variable, value) variable -= (value)
65 #define ULL_Sub32(variable, value) variable -= ((U64BIT)value)
66 #define ULL_Mul32(variable, value) variable *= ((U64BIT)value)
67 #define ULL_Div32(variable, value) variable /= ((U64BIT)value)
68 #define ULL_ShiftLeft(variable, value) variable <<= (value)
69 #define ULL_ShiftRight(variable, value) variable >>= (value)
70 #define ULL_Set32(variable, value) variable = (U64BIT)value
71 #define ULL_SetInvalid(variable) variable = INVALID_64BIT_VAL
72 #define ULL_IsValid(variable) variable != INVALID_64BIT_VAL
73 #define ULL_IsEqual(variable, value) (variable == value)
74 #define ULL_Mod32(variable, value) (variable % (value))
75 #define ULL_Compare(first, second) (first > second) ? 1 : (first == second) ? 0 : -1
76 #define ULL_Compare32(first, second) UL_Compare(first, ((U64BIT)second))
79 #define ULL_Get32(variable) variable.l
80 #define ULL_Add(variable, value) variable = ULONG_Add(variable, value)
81 #define ULL_Add32(variable, value) variable = ULONG_Add32(variable, value)
82 #define ULL_Sub(variable, value) variable = ULONG_Sub(variable, value)
83 #define ULL_Sub32(variable, value) variable = ULONG_Sub32(variable, value)
84 #define ULL_Mul32(variable, value) variable = ULONG_Mul32(variable, value)
85 #define ULL_Div32(variable, value) variable = ULONG_Div32(variable, value)
86 #define ULL_ShiftLeft(variable, value) variable = ULONG_ShiftLeft(variable, value)
87 #define ULL_ShiftRight(variable, value) variable = ULONG_ShiftRight(variable, value)
88 #define ULL_Set32(variable, value) variable.h = 0; variable.l = value;
89 #define ULL_SetInvalid(variable) variable.h = 0xffffffffU; variable.l = 0xffffffffU;
90 #define ULL_IsValid(variable) ((variable.h != 0xffffffffU) || (variable.l != 0xffffffffU))
91 #define ULL_IsEqual(variable, value) (variable.l == value.l && variable.h == value.h)
92 #define ULL_Mod32(variable, value) ULONG_Mod32(variable, value)
93 #define ULL_Compare(first, second) ULONG_Compare(first, second)
94 #define ULL_Compare32(first, second) ULONG_Compare32(first, second)
97 #define ULL_Itoa(variable, str) ULONG_Itoa(variable, str)
103 #ifdef USE_TRUE_64BIT
117 #ifndef USE_TRUE_64BIT
232 U64BIT ULONG_Atoi(char *str);
void ULONG_Itoa(U64BIT variable, char *str)
Convert unsigned 64 bit to a string. The string should be able to hold at least 21 characters...
Definition: glue_ulong.c:427
S32BIT ULONG_Compare(U64BIT first, U64BIT second)
Compare two variables, returning a value that indicates the result of the comparison.
Definition: glue_ulong.c:321
U64BIT ULONG_Add32(U64BIT variable, U32BIT value)
Add a 32-bit value to a unsigned 64 bit variable.
Definition: glue_ulong.c:68
U64BIT ULONG_ShiftLeft(U64BIT variable, U32BIT value)
Shift bits left on unsigned 64 bit variable by a 32-bit value.
Definition: glue_ulong.c:236
U64BIT ULONG_ShiftRight(U64BIT variable, U32BIT value)
Shift bits right on unsigned 64 bit variable by a 32-bit value.
Definition: glue_ulong.c:266
U32BIT l
Definition: glue_ulong.h:109
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...
Definition: glue_ulong.c:108
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...
Definition: glue_ulong.c:364
int32_t S32BIT
Definition: techtype.h:98
System Wide Global Technical Data Type Definitions.
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...
Definition: glue_ulong.c:299
U64BIT ULONG_Add(U64BIT variable, U64BIT value)
Add a value to a unsigned 64 bit variable.
Definition: glue_ulong.c:48
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...
Definition: glue_ulong.c:89
U64BIT ULONG_Mul32(U64BIT variable, U32BIT value)
Multiply a unsigned 64 bit variable by a 32-bit value.
Definition: glue_ulong.c:124
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 ...
Definition: glue_ulong.c:195
uint32_t U32BIT
Definition: techtype.h:97
Definition: glue_ulong.h:109