diff --git a/hbvm/src/vm/mem/mod.rs b/hbvm/src/vm/mem/mod.rs index bad822e..28d1382 100644 --- a/hbvm/src/vm/mem/mod.rs +++ b/hbvm/src/vm/mem/mod.rs @@ -154,7 +154,7 @@ impl Memory { 2 => 1024_usize.pow(3), _ => unreachable!(), }, - offset: addr as usize & ((1 << 12) - 1), + offset: addr as usize & ((1 << (lvl * 9 + 12)) - 1), }) } }