fix ByteBuffer.grow (#2622)

* fix ByteBuffer.grow

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
Walther Chen
2025-12-06 23:57:11 +07:00
committed by GitHub
parent cb0b94c064
commit f023db8638
2 changed files with 2 additions and 1 deletions

View File

@@ -130,7 +130,7 @@ fn usz? ByteBuffer.available(&self) @inline @dynamic
fn void ByteBuffer.grow(&self, usz n) fn void ByteBuffer.grow(&self, usz n)
{ {
n = math::next_power_of_2(n); n = math::next_power_of_2(self.bytes.len + n);
char* p = allocator::realloc(self.allocator, self.bytes, n); char* p = allocator::realloc(self.allocator, self.bytes, n);
self.bytes = p[:n]; self.bytes = p[:n];
} }

View File

@@ -9,6 +9,7 @@
- Regression with npot vector in struct triggering an assert #2219. - Regression with npot vector in struct triggering an assert #2219.
- Casting bitstruct to wider base type should be single step #2616. - Casting bitstruct to wider base type should be single step #2616.
- Optional does not play well with bit ops #2618. - Optional does not play well with bit ops #2618.
- `Bytebuffer.grow` was broken #2622.
### Stdlib changes ### Stdlib changes