libart icon indicating copy to clipboard operation
libart copied to clipboard

Integer keys need byte-ordering swap?

Open pohchaichon opened this issue 4 years ago • 1 comments

Hi!

I am trying to use this implementation of ART for 64-bit unsigned integer keys. Since the interface accept unsigned char array, I would like to confirm that integer keys needs to have their byte-ordering swap in little-endian machine?

i.e. instead of

uint64_t key = 123456789
void* val_ptr = art_search(&t, (unsigned char*) &key, sizeof(uint64_t));

I should do

uint64_t key = 123456789
uint64_t reversed_key = __builtin_bswap64(key);
void* val_ptr = art_search(&t, (unsigned char*) &reversed_key, sizeof(uint64_t));

Thank you!

pohchaichon avatar Nov 27 '21 08:11 pohchaichon