1 /* minix/u64.h Author: Kees J. Bot
3 * Functions to manipulate 64 bit disk addresses.
12 #define is_zero64(i) ((i) == 0)
13 #define make_zero64(i) ((i) = 0)
14 #define neg64(i) ((i) = -(i))
16 static inline u64_t
add64(u64_t i
, u64_t j
)
21 static inline u64_t
add64u(u64_t i
, unsigned j
)
26 static inline u64_t
add64ul(u64_t i
, unsigned long j
)
31 static inline int bsr64(u64_t i
)
36 for (index
= 63, mask
= 1ULL << 63; index
>= 0; --index
, mask
>>= 1) {
44 static inline int cmp64(u64_t i
, u64_t j
)
54 static inline int cmp64u(u64_t i
, unsigned j
)
64 static inline int cmp64ul(u64_t i
, unsigned long j
)
74 static inline unsigned cv64u(u64_t i
)
76 /* return ULONG_MAX if really big */
83 static inline unsigned long cv64ul(u64_t i
)
85 /* return ULONG_MAX if really big */
89 return (unsigned long)i
;
92 static inline u64_t
cvu64(unsigned i
)
97 static inline u64_t
cvul64(unsigned long i
)
102 static inline unsigned diff64(u64_t i
, u64_t j
)
104 return (unsigned)(i
- j
);
107 static inline u64_t
div64(u64_t i
, u64_t j
)
112 static inline u64_t
rem64(u64_t i
, u64_t j
)
117 static inline unsigned long div64u(u64_t i
, unsigned j
)
119 return (unsigned long)(i
/ j
);
122 static inline u64_t
div64u64(u64_t i
, unsigned j
)
127 static inline unsigned rem64u(u64_t i
, unsigned j
)
129 return (unsigned)(i
% j
);
132 static inline unsigned long ex64lo(u64_t i
)
134 return (unsigned long)i
;
137 static inline unsigned long ex64hi(u64_t i
)
139 return (unsigned long)(i
>>32);
142 static inline u64_t
make64(unsigned long lo
, unsigned long hi
)
144 return ((u64_t
)hi
<< 32) | (u64_t
)lo
;
147 static inline u64_t
mul64(u64_t i
, u64_t j
)
152 static inline u64_t
mul64u(unsigned long i
, unsigned j
)
157 static inline u64_t
sub64(u64_t i
, u64_t j
)
162 static inline u64_t
sub64u(u64_t i
, unsigned j
)
167 static inline u64_t
sub64ul(u64_t i
, unsigned long j
)
172 u64_t
rrotate64(u64_t x
, unsigned short b
);
173 u64_t
rshift64(u64_t x
, unsigned short b
);
174 u64_t
xor64(u64_t a
, u64_t b
);
175 u64_t
and64(u64_t a
, u64_t b
);
176 u64_t
not64(u64_t a
);
178 #endif /* _MINIX__U64_H */