MCPcopy Create free account
hub / github.com/awslabs/llrt / add_bytecode_header

Function add_bytecode_header

llrt_core/src/bytecode.rs:22–33  ·  view source on GitHub ↗
(bytes: Vec<u8>, file_size: Option<u32>)

Source from the content-addressed store, hash-verified

20
21#[allow(dead_code)]
22pub fn add_bytecode_header(bytes: Vec<u8>, file_size: Option<u32>) -> Vec<u8> {
23 let mut compressed_bytes = Vec::with_capacity(bytes.len());
24 compressed_bytes.extend_from_slice(BYTECODE_VERSION.as_bytes());
25 if let Some(file_size) = file_size {
26 compressed_bytes.push(BYTECODE_COMPRESSED);
27 compressed_bytes.extend_from_slice(&file_size.to_le_bytes());
28 } else {
29 compressed_bytes.push(BYTECODE_UNCOMPRESSED)
30 }
31 compressed_bytes.extend_from_slice(&bytes);
32 compressed_bytes
33}

Callers 3

generate_bytecode_cacheFunction · 0.85
compress_bytecodeFunction · 0.85
compress_moduleFunction · 0.85

Calls 3

pushMethod · 0.80
lenMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected