better bitp_set
apparently gcc & clang aren't smart enough to notice the unnecessary intermediate u64
This commit is contained in:
parent
3b2b9bba1a
commit
00a64101e9
@ -25,7 +25,7 @@ typedef TyArr BitArr;
|
|||||||
#define BIT_N(IA) (((IA)+63) >> 6) // u64 count needed to store IA bits
|
#define BIT_N(IA) (((IA)+63) >> 6) // u64 count needed to store IA bits
|
||||||
|
|
||||||
static inline void bitp_set(u64* arr, u64 n, bool v) {
|
static inline void bitp_set(u64* arr, u64 n, bool v) {
|
||||||
u64 m = ((u64)1)<<(n&7);
|
u8 m = ((u8)1) << (n&7);
|
||||||
if (v) ((u8*)arr)[n>>3]|= m;
|
if (v) ((u8*)arr)[n>>3]|= m;
|
||||||
else ((u8*)arr)[n>>3]&= ~m;
|
else ((u8*)arr)[n>>3]&= ~m;
|
||||||
// arr[n>>6] = (arr[n>>6]&(~m)) | (((u64)v)<<(n&63));
|
// arr[n>>6] = (arr[n>>6]&(~m)) | (((u64)v)<<(n&63));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user