Skip to content

Commit

Permalink
Round up to the next power of 2 for flatbuffer builder allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
VirxEC committed Apr 11, 2024
1 parent b634136 commit 267e1c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ impl PythonBindGenerator {
}

if self.has_complex_pack {
self.write_str(" let size = flat_t.get_size();");
self.write_str(" let size = flat_t.get_size().next_power_of_two();");
self.write_str("");
self.write_str(" let mut builder = FlatBufferBuilder::with_capacity(size);");
self.write_str(" let offset = flat_t.pack(&mut builder);");
Expand Down

0 comments on commit 267e1c8

Please sign in to comment.