diff --git a/core/editor/src/input/keyboard.rs b/core/editor/src/input/keyboard.rs index ca9e2fd5d..113991d60 100644 --- a/core/editor/src/input/keyboard.rs +++ b/core/editor/src/input/keyboard.rs @@ -2,7 +2,9 @@ pub const NUMBER_OF_KEYS: usize = Key::NumKeys as usize; // Edit this to specify the storage type used // TODO: Increase size of type pub type StorageType = u128; -const STORAGE_SIZE: u32 = std::mem::size_of::() as u32 * 8 + 2 - std::mem::size_of::().leading_zeros(); + +// base 2 logarithm of the storage type used to represents how many bits you need to fully address every bit in that storage type +const STORAGE_SIZE: u32 = (std::mem::size_of::() * 8).trailing_zeros(); const STORAGE_SIZE_BITS: usize = 1 << STORAGE_SIZE; const KEY_MASK_STORAGE_LENGTH: usize = (NUMBER_OF_KEYS + STORAGE_SIZE_BITS - 1) >> STORAGE_SIZE; pub type KeyStates = BitVector;