Align the section to `alignment` bytes by zero-padding.
(&mut self, alignment: usize)
| 75 | |
| 76 | /// Align the section to `alignment` bytes by zero-padding. |
| 77 | pub fn align_to(&mut self, alignment: usize) { |
| 78 | if alignment <= 1 { |
| 79 | return; |
| 80 | } |
| 81 | let rem = self.bytes.len() % alignment; |
| 82 | if rem != 0 { |
| 83 | let padding = alignment - rem; |
| 84 | self.bytes.extend(std::iter::repeat_n(0u8, padding)); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | pub fn define_label(&mut self, name: String) { |
| 89 | self.symbols.push((name, self.current_offset())); |