pub fn trim(self: *Self) void self: *Self96
97
98
99
100
101
102
103
104
105
106
107
108 pub fn trim(self: *Self) void {
// All of the following calls to `Self::trim` can't panic because:
//
// 1. `parse_decimal` sets `num_digits` to a max of `max_digits`.
// 2. `right_shift` sets `num_digits` to `write_index`, which is bounded by `num_digits`.
// 3. `left_shift` `num_digits` to a max of `max_digits`.
//
// Trim is only called in `right_shift` and `left_shift`.
std.debug.assert(self.num_digits <= max_digits);
while (self.num_digits != 0 and self.digits[self.num_digits - 1] == 0) {
self.num_digits -= 1;
}
}
Trim trailing zeroes from the buffer