Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

shift_bit

Computes 2^number for bit positions 0-7 within a byte

This helper function returns the value of 2 raised to the given power, specifically designed for bit manipulation within a single byte (0-7 bit positions). It provides fast lookup for common bit shift operations.

Arguments

  • number - The bit position (0-7) to compute 2^number for

Returns

  • u8 - The value 2^number as a u8, panics if number > 7

Fully qualified path: alexandria_bytes::bit_array::shift_bit

pub fn shift_bit(number: u32) -> u8