MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / encode_branch_value

Function encode_branch_value

atomic-core/src/crdt/tables.rs:541–549  ·  view source on GitHub ↗
(data: &SerializedBranch)

Source from the content-addressed store, hash-verified

539/// ```
540#[inline]
541pub fn encode_branch_value(data: &SerializedBranch) -> [u8; 24] {
542 let mut bytes = [0u8; 24];
543 let trunk_bytes = encode_trunk_id(&data.trunk_id);
544 bytes[0..12].copy_from_slice(&trunk_bytes);
545 bytes[12] = encode_branch_state(data.state);
546 // bytes[13..16] are padding (already zeroed)
547 bytes[16..24].copy_from_slice(&data.line_hash.to_le_bytes());
548 bytes
549}
550
551/// Decode branch data from 24 bytes.
552#[inline]

Calls 3

encode_trunk_idFunction · 0.85
encode_branch_stateFunction · 0.85
to_le_bytesMethod · 0.80