oxabl-cache-format 0.3.0

Byte formats for the oxabl-cache remote compile cache: frames, ids, limits.
Documentation
1
2
3
4
5
6
7
8
9
10
/// Padmé length of a plaintext of `len` bytes, or `None` if it does not fit in `u64`.
pub fn padme(len: u64) -> Option<u64> {
    if len < 2 {
        return Some(len);
    }
    let e = len.ilog2();
    let s = e.ilog2() + 1;
    let mask = (1u64 << (e - s)) - 1;
    len.checked_add(mask).map(|v| v & !mask)
}