Closed lizelive closed 3 years ago
(y - MIN_Y) >> 4 as u8
does the same thing as
https://github.com/owengage/fastnbt/blob/10e0edf0758916395e1a0de5e62b7c7a42d8465e/fastanvil/src/java/section_tower.rs#L60
i think this is prob fast enough to not use a lookup table.
const fn y_to_index(y: isize) -> u8 { ((y - MIN_Y)>> 4) as u8 }
compiles to
example::y_to_index: lea eax, [rdi + 64] shr eax, 4 ret
Looks right to me. Way simpler. I'll give this a try soon with my benchmark world render. I suspect you're right about performance.
Thanks for the report. :)
Done on master. It's a little bit faster :)
(y - MIN_Y) >> 4 as u8
does the same thing as
https://github.com/owengage/fastnbt/blob/10e0edf0758916395e1a0de5e62b7c7a42d8465e/fastanvil/src/java/section_tower.rs#L60
i think this is prob fast enough to not use a lookup table.
compiles to