GitoxideLabs/gitoxide · info
we are not on 16 bit systems
Error message
we are not on 16 bit systems
What it means
`EwahBitmap::num_bits` converts an internal `u32` bit counter to `usize` with `.expect("we are not on 16 bit systems")`. On platforms where `usize` is 16 bits the `try_into` fails; on all modern platforms (32/64-bit) it cannot fail.
Solutions
- Build for a 32-bit or 64-bit target
- If 16-bit support is genuinely needed, change the counter to usize and drop the conversion upstream
- Avoid using gix (and this bitmap) on 16-bit platforms — it is unsupported
Example fix
// before
self.num_bits.try_into().expect("we are not on 16 bit systems")
// after
usize::from(self.num_bits) Defensive patterns
Strategy: validation
Validate before calling
// at build time, reject 16-bit targets
cfg_if::cfg_if! { if #[cfg(target_pointer_width = "16")] { compile_error!("gix-bitmap requires >=32-bit usize"); } } Prevention
- Target 32/64-bit platforms only
- Add a compile_error! guard for pointer_width = 16 in dependent projects
When it happens
Trigger: Calling `num_bits()` on a target with 16-bit `usize`. Normal desktop/server Rust targets (x86_64, aarch64, etc.) are unaffected.
Common situations: Compiling gix-bitmap for exotic embedded targets with 16-bit pointers.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- ' ' is not a valid configuration key
- Cannot use iter_v1() on index of type
- Cannot use iter_v2() on index of type
- BUG: tries to obtain object id from symbolic target
- BUG: expected peeled reference target but found symbolic one
AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08).
Data as JSON: /api/errors/7d422e7af11aeddc.
Report an issue: GitHub.
Appendix: source
Thrown at gix-bitmap/src/ewah.rs:146
}
let bits_in_word = remaining.min(64);
if bits_in_word < 64 && (word >> bits_in_word) != 0 {
return None;
}
for bit_index in 0..bits_in_word {
if word & (1 << bit_index) != 0 {
f(index)?;
}
index += 1;
}
}
}
Some(())
}
/// The amount of bits we are currently holding.
pub fn num_bits(&self) -> usize {
self.num_bits.try_into().expect("we are not on 16 bit systems")
}
}
#[inline]
fn rlw_running_len_bits(w: &u64) -> u64 {
rlw_running_len(w) * 64
}
#[inline]
fn rlw_running_len(w: &u64) -> u64 {
(w >> 1) & RLW_LARGEST_RUNNING_COUNT
}
#[inline]
fn rlw_literal_words(w: &u64) -> u64 {
w >> (1 + RLW_RUNNING_BITS)
}
View on GitHub (pinned to e73179060b)