1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const ONLY_HIGH_BIT_U8: u8 = 0b_1000_0000;
const ONLY_SECOND_HIGH_BIT_U8: u8 = 0b_0100_0000;
#[inline(always)]
pub fn set_high_bit_u8(input: u8) -> u8 {
input | ONLY_HIGH_BIT_U8
}
#[inline(always)]
pub fn unset_high_bit_u8(input: u8) -> u8 {
input << 1 >> 1
}
#[inline(always)]
pub fn unset_second_high_bit_u8(input: u8) -> u8 {
input << 2 >> 2
}
#[inline(always)]
pub fn is_high_bit_set(input: u8) -> bool {
input & ONLY_HIGH_BIT_U8 != 0
}
#[inline(always)]
pub fn set_second_high_bit_u8(input: u8) -> u8 {
input | ONLY_SECOND_HIGH_BIT_U8
}
#[inline(always)]
pub fn is_second_high_bit_set(input: u8) -> bool {
input & ONLY_SECOND_HIGH_BIT_U8 != 0
}