3 ms·
This seems like a good use case for a bit mask query function. I see Rust has a bitflags crate: https://doc.rust-lang.org/bitflags/bitflags/index.html https://
by cpeterso 10y ago
This seems like a good use case for a bit mask query function. I see Rust has a bitflags crate:
https://doc.rust-lang.org/bitflags/bitflags/index.html https://doc.rust-lang.org/bitflags/bitflags/index.html
- bluejekyll 10y agoI found that after I had already written a lot of that code. I haven't had much reason to go back and change it, but any PR's if someone wants to do it, would be accepted.
- deleted 10y ago[deleted]
- vog 10y agoWhat about simply replacing all "== 0b..." with "!= 0"? That would already be a good improvement, both in terms of DRY and readability, without the need of adding another dependency.