crosvm/acpi_tables
Daniel Verkamp 00571bf162 acpi_tables: avoid extra AML allocations and copies
Many of the Aml implementations wrote temporary results into a Vec<u8>,
then appended that Vec to the aml bytestream. Instead, append or insert
directly into the aml vector to avoid the extra allocations and copies.

This also eliminates the confusing reverse() calls when inserting the
PkgLength, which were needed due to inserting the encoded length one
byte at a time at the beginning of the bytestream; instead, use the
splice() function to insert all of the bytes in order at once.

BUG=None
TEST=cargo test -p acpi_tables

Change-Id: If97d9f0dec9e2654716761c0827d9f2cbaa4f54a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5660936
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
2024-06-27 18:14:13 +00:00
..
src acpi_tables: avoid extra AML allocations and copies 2024-06-27 18:14:13 +00:00
Cargo.toml Cargo.toml: move tempfile to dev-dependencies 2024-05-07 20:00:48 +00:00