diff --git a/agb/src/bitarray.rs b/agb/src/bitarray.rs index 63adc0d0..6f7c08ea 100644 --- a/agb/src/bitarray.rs +++ b/agb/src/bitarray.rs @@ -9,7 +9,7 @@ impl Bitarray { pub fn get(&self, index: usize) -> Option { if index < N * 32 { - Some((self.a[index / 32] >> (N % 32) & 1) != 0) + Some((self.a[index / 32] >> (index % 32) & 1) != 0) } else { None } @@ -17,8 +17,8 @@ impl Bitarray { pub fn set(&mut self, index: usize, value: bool) { let value = value as u32; - let mask = 1 << (N % 32); - let value_mask = value << (N % 32); + let mask = 1 << (index % 32); + let value_mask = value << (index % 32); self.a[index / 32] = self.a[index / 32] & !mask | value_mask } }