MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / encode_handle

Function encode_handle

nodedb/src/engine/kv/slab.rs:311–315  ·  view source on GitHub ↗
(tier_idx: u8, slot_idx: u32)

Source from the content-addressed store, hash-verified

309const SLOT_MASK: u32 = (1 << 28) - 1;
310
311fn encode_handle(tier_idx: u8, slot_idx: u32) -> u32 {
312 debug_assert!(tier_idx < 8);
313 debug_assert!(slot_idx <= SLOT_MASK);
314 ((tier_idx as u32) << TIER_SHIFT) | slot_idx
315}
316
317fn decode_handle(handle: u32) -> (u8, u32) {
318 let tier_idx = ((handle >> TIER_SHIFT) & 0x7) as u8;

Callers 2

allocMethod · 0.85

Calls

no outgoing calls

Tested by 1