Function armorlib::util::u8s_to_u32 [] [src]

pub fn u8s_to_u32(first: u8, second: u8, third: u8, fourth: u8) -> u32

A utility function that, given four u8s, uses a bit shift operation and a binary OR operation to return a u32. The first 8 bits of this u32 are those of the argument first, the second 8 bits are those of the argument second, the third eight bits from third, and the final 8 bits from fourth.

Examples

use armorlib::util;
let first = 0x12_u8;
let second = 0xAB_u8;
let third = 0xDE_u8;
let fourth = 0x53_u8;
assert_eq!(util::u8s_to_u32(first, second, third, fourth), 0x12ABDE53_u32);