Calculates the size of, in bytes, of the top n [Memory] entries in the value stack.
(&self, top: usize)
| 469 | /// Calculates the size of, in bytes, of the top n [Memory] entries |
| 470 | /// in the value stack. |
| 471 | pub fn sizeof(&self, top: usize) -> u32 { |
| 472 | self.peekn(top).fold(0, |acc, v| { |
| 473 | if v.is_mem() { |
| 474 | acc + v.unwrap_mem().slot.size |
| 475 | } else { |
| 476 | acc |
| 477 | } |
| 478 | }) |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | #[cfg(test)] |
no test coverage detected