From 9fad597844c3b7a9da3aab9f3a0f18c2eebad056 Mon Sep 17 00:00:00 2001 From: Corwin Kuiper Date: Fri, 4 Jun 2021 18:36:08 +0100 Subject: [PATCH] fix faulty implementation --- agb/src/bitarray.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agb/src/bitarray.rs b/agb/src/bitarray.rs index 381cf5a1..d6ec5563 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 / N] >> (N % 32) & 1) != 0) + Some((self.a[index / 32] >> (N % 32) & 1) != 0) } else { None } @@ -19,7 +19,7 @@ impl Bitarray { let value = value as u32; let mask = 1 << (N % 32); let value_mask = value << (N % 32); - self.a[index / N] = self.a[index / N] & !mask | value_mask + self.a[index / 32] = self.a[index / 32] & !mask | value_mask } }