1 /* minix/u64.h Author: Kees J. Bot
3 * Functions to manipulate 64 bit disk addresses.
9 #include <minix/types.h>
14 #define is_zero64(i) ((i) == 0)
15 #define make_zero64(i) ((i) = 0)
16 #define neg64(i) ((i) = -(i))
18 static inline u64_t
add64(u64_t i
, u64_t j
)
23 static inline u64_t
add64u(u64_t i
, unsigned j
)
28 static inline u64_t
add64ul(u64_t i
, unsigned long j
)
33 static inline int bsr64(u64_t i
)
38 for (index
= 63, mask
= 1ULL << 63; index
>= 0; --index
, mask
>>= 1) {
46 static inline int cmp64(u64_t i
, u64_t j
)
56 static inline int cmp64u(u64_t i
, unsigned j
)
66 static inline int cmp64ul(u64_t i
, unsigned long j
)
76 static inline unsigned cv64u(u64_t i
)
78 /* return ULONG_MAX if really big */
85 static inline unsigned long cv64ul(u64_t i
)
87 /* return ULONG_MAX if really big */
91 return (unsigned long)i
;
94 static inline u64_t
cvu64(unsigned i
)
99 static inline u64_t
cvul64(unsigned long i
)
104 static inline unsigned diff64(u64_t i
, u64_t j
)
106 return (unsigned)(i
- j
);
109 static inline u64_t
div64(u64_t i
, u64_t j
)
114 static inline u64_t
rem64(u64_t i
, u64_t j
)
119 static inline unsigned long div64u(u64_t i
, unsigned j
)
121 return (unsigned long)(i
/ j
);
124 static inline u64_t
div64u64(u64_t i
, unsigned j
)
129 static inline unsigned rem64u(u64_t i
, unsigned j
)
131 return (unsigned)(i
% j
);
134 static inline unsigned long ex64lo(u64_t i
)
136 return (unsigned long)i
;
139 static inline unsigned long ex64hi(u64_t i
)
141 return (unsigned long)(i
>>32);
144 static inline u64_t
make64(unsigned long lo
, unsigned long hi
)
146 return ((u64_t
)hi
<< 32) | (u64_t
)lo
;
149 static inline u64_t
mul64(u64_t i
, u64_t j
)
154 static inline u64_t
mul64u(unsigned long i
, unsigned j
)
159 static inline u64_t
sub64(u64_t i
, u64_t j
)
164 static inline u64_t
sub64u(u64_t i
, unsigned j
)
169 static inline u64_t
sub64ul(u64_t i
, unsigned long j
)
174 u64_t
rrotate64(u64_t x
, unsigned short b
);
175 u64_t
rshift64(u64_t x
, unsigned short b
);
176 u64_t
xor64(u64_t a
, u64_t b
);
177 u64_t
and64(u64_t a
, u64_t b
);
178 u64_t
not64(u64_t a
);
180 #endif /* _MINIX__U64_H */