Macro scratchpad::array_len_for_bytes [] [src]

macro_rules! array_len_for_bytes {
    ($element:ty, $bytes:expr) => { ... };
    ($element:ty, $bytes:expr,) => { ... };
}

Returns the minimum number of elements of a given type necessary for storage of a given byte count. The actual supported byte count may be larger due to padding.

Examples

#[macro_use]
extern crate scratchpad;

assert_eq!(array_len_for_bytes!(u64, 32), 4);