oxc/crates/oxc_syntax
overlookmotel 96fc94f61e refactor(syntax): use NonMaxU32 for IDs (#4467)
`SymbolId` and `ReferenceId` are stored as `NonZeroU32`, but with a wrapper to make `u32::MAX` the illegal value, instead of `0`.

Use the existing `nonmax` crate for this. Our current implementation uses `idx + 1` to avoid the zero value, whereas `nonmax` crate uses XOR `idx ^ u32::MAX`, which is a cheaper operation.

Initially I made this change manually instead of pulling in a dependency, but it's a pain because it requires implementing `Debug` and `PartialOrd` by hand to handle the difference between the "actual" value and its stored representation. So I thought better to use a crate which does this for us.
2024-07-26 00:14:47 +00:00
..
src refactor(syntax): use NonMaxU32 for IDs (#4467) 2024-07-26 00:14:47 +00:00
Cargo.toml refactor(syntax): use NonMaxU32 for IDs (#4467) 2024-07-26 00:14:47 +00:00
CHANGELOG.md Release crates v0.22.0 (#4434) 2024-07-24 08:23:27 +08:00