Last active
March 3, 2018 06:53
-
-
Save Madsy/3bea8cb41621a4804cf6a194756d721e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void S_to_bit_vector(u32* S, int count, u32* out){ | |
for(int i = 0; i < count; i++){ | |
//assuming 32-bit integers | |
u32 integer_index = S[i] / 32u; | |
//mask all bits that fit | |
u32 bit_index = S[i] & 31; | |
out[integer_index] |= 1<<bit_index; | |
} | |
} | |
inline u32 f_S(u32* S_bv, u32 s){ | |
u32 integer_index = s / 32u; | |
u32 bit_index = s & 31; | |
return S_bv[integer_index] & (1<<bit_index); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment