tried fewer but simpler bucketing
This commit is contained in:
parent
2c5b0b1177
commit
30e868d154
3
makefile
3
makefile
@ -16,6 +16,9 @@ release: test.cpp magyarsort.h
|
||||
release_ypsu: ypsu.cpp magyarsort.h
|
||||
g++ ypsu.cpp -DNDEBUG -std=c++17 -O2 -o ypsu.out
|
||||
|
||||
release3_ypsu: ypsu.cpp magyarsort.h
|
||||
g++ ypsu.cpp -DNDEBUG -std=c++17 -O3 -o ypsu.out
|
||||
|
||||
release_ypsu_assert: ypsu.cpp magyarsort.h
|
||||
g++ ypsu.cpp -std=c++17 -O2 -o ypsu.out
|
||||
|
||||
|
||||
@ -24,8 +24,12 @@ static inline uint32_t witch_bucket(uint32_t key) {
|
||||
/* This approach uses 12 bits from a 32 bit float to map onto a byte bucket index */
|
||||
th2_fu as;
|
||||
as.f = (float) key;
|
||||
|
||||
uint32_t witch_base = (key <= 2) ? 0 : (as.u >> 23) - 128; // 0, [127..159] -> [0..31]
|
||||
return witch_base * 8 + ((as.u >> (23 - 3)) & 7);
|
||||
/* Alternative (but I measure it being worse):
|
||||
return (as.u >> 23);
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user