Skip to main content

bits_for_palette_len

Function bits_for_palette_len 

Source
pub const fn bits_for_palette_len(palette_len: usize) -> Option<u8>
Expand description

Calculates the number of bits needed to represent indices into a palette. Only returns power-of-2 values: 1, 2, 4, 8, or 16.

Returns None for homogeneous containers (palette length 0 or 1).