Re:Lessons learned from profiling an algorithm in Rust
by durumu on Monday October 14, 2024 @11:25AM
(#41838397)
I think it's i & 32. Agreed on that being more readable.
Re:Lessons learned from profiling an algorithm in Rust
by urcyanide on Monday October 14, 2024 @11:59AM
(#41838771)
Yes, i&32 is more readable.
Re:Lessons learned from profiling an algorithm in Rust
by urcyanide on Monday October 14, 2024 @11:18AM
(#41838328)
Not really, i \in (0..dim).step_by(32), shift \in {0, 32}, but for `i % 32` it's 0..32
Re:Lessons learned from profiling an algorithm in Rust
by chrismorgan on Monday October 14, 2024 @11:44AM
(#41838588)
Sorry, I wrote `i % 32` by accident, I meant `i & 32`.
Re:Lessons learned from profiling an algorithm in Rust
by NovaX on Monday October 14, 2024 @12:46PM
(#41839263)
I believe it is (!i & 32) because the bitwise version is an incorrect rewrite.
Re:Lessons learned from profiling an algorithm in Rust
by urcyanide on Monday October 14, 2024 @01:04PM
(#41839473)
Sorry for the confusing example. The bitwise one is correct since I store the binary in u64 with a different endian from the C++ version. (this happens because the C++ version is using a numpy script to do the preprocessing) My bad, I should explain it in a better way. Will update the post.
(Edit: fixed from i % 32 to i & 32.)