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

Function compare_field_i64

nodedb-query/src/msgpack_scan/compare.rs:118–125  ·  view source on GitHub ↗

Compare two numeric MessagePack values as i64. Useful when the caller knows both values are integers.

(a_buf: &[u8], a_off: usize, b_buf: &[u8], b_off: usize)

Source from the content-addressed store, hash-verified

116/// Compare two numeric MessagePack values as i64.
117/// Useful when the caller knows both values are integers.
118pub fn compare_field_i64(a_buf: &[u8], a_off: usize, b_buf: &[u8], b_off: usize) -> Ordering {
119 match (read_i64(a_buf, a_off), read_i64(b_buf, b_off)) {
120 (Some(a), Some(b)) => a.cmp(&b),
121 (Some(_), None) => Ordering::Greater,
122 (None, Some(_)) => Ordering::Less,
123 (None, None) => Ordering::Equal,
124 }
125}
126
127/// Check if two MessagePack values are byte-identical.
128/// For canonical-encoded documents, byte equality implies semantic equality.

Callers

nothing calls this directly

Calls 2

read_i64Function · 0.85
cmpMethod · 0.45

Tested by

no test coverage detected