Bits per dim for an `n`-dim schema, dividing [`PREFIX_BITS`] evenly (truncated). Returns at least 1 bit per dim.
(n_dims: usize)
| 23 | /// Bits per dim for an `n`-dim schema, dividing [`PREFIX_BITS`] evenly |
| 24 | /// (truncated). Returns at least 1 bit per dim. |
| 25 | pub fn bits_per_dim(n_dims: usize) -> u32 { |
| 26 | if n_dims == 0 { |
| 27 | return 0; |
| 28 | } |
| 29 | let raw = PREFIX_BITS / n_dims as u32; |
| 30 | raw.max(1) |
| 31 | } |
| 32 | |
| 33 | /// Normalize one cell coordinate into per-dim integer coordinates in |
| 34 | /// `[0, 2^bits)`. The output `Vec` has the same arity as the schema. |
no outgoing calls
no test coverage detected