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

Function check_shape

nodedb-array/src/coord/zorder.rs:41–55  ·  view source on GitHub ↗
(n: usize, bits: u32)

Source from the content-addressed store, hash-verified

39}
40
41fn check_shape(n: usize, bits: u32) -> ArrayResult<()> {
42 if n > MAX_DIMS {
43 return Err(ArrayError::InvalidSchema {
44 array: String::new(),
45 detail: format!("zorder: arity {n} exceeds MAX_DIMS={MAX_DIMS}"),
46 });
47 }
48 if bits == 0 || (n as u32) * bits > 64 {
49 return Err(ArrayError::InvalidSchema {
50 array: String::new(),
51 detail: format!("zorder: {n} dims × {bits} bits exceeds 64-bit prefix"),
52 });
53 }
54 Ok(())
55}
56
57#[cfg(test)]
58mod tests {

Callers 2

encodeFunction · 0.70
decodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected