Skip to content

Commit 068f44b

Browse files
committed
Fix building on 32 bit architectures
bitclean war previously implemented for size_t and uint32_t, which overlap on 32 bit architectures. Implementing it for uint32_t and uint64_t might leave the latter unused on 32 bit builds, but is consistent and works on both. Closes: #143
1 parent cc90812 commit 068f44b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

libhdt/src/util/bitutil.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,18 @@ inline uint32_t wordSelect1(uint64_t value, uint64_t rank) {
6666
#define SIZET_SIZE (sizeof(size_t)*8)
6767

6868
/** reads bit p from e */
69-
inline bool bitget(size_t *e, size_t p) {
70-
return (e[p/SIZET_SIZE] >> (p%SIZET_SIZE)) & 1;
69+
inline bool bitget(uint64_t *e, size_t p) {
70+
return (e[p/64] >> (p%64)) & 1;
7171
}
7272

7373
/** sets bit p in e */
74-
inline void bitset(size_t * e, size_t p) {
75-
e[p/SIZET_SIZE] |= (((size_t)1)<<(p%SIZET_SIZE));
74+
inline void bitset(uint64_t * e, size_t p) {
75+
e[p/64] |= (((uint64_t)1)<<(p%64));
7676
}
7777

7878
/** cleans bit p in e */
79-
inline void bitclean(size_t * e, size_t p) {
80-
e[p/SIZET_SIZE] &= ~(((size_t)1)<<(p%SIZET_SIZE));
79+
inline void bitclean(uint64_t * e, size_t p) {
80+
e[p/64] &= ~(((size_t)1)<<(p%64));
8181
}
8282

8383

0 commit comments

Comments
 (0)