summaryrefslogtreecommitdiff
path: root/tests/src/bitwise.rs
blob: be12cea09f648cdb48d84870597532a810c782d4 (plain)
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
//@ [!borrow-check] aeneas-args=-test-trans-units
//@ [coq,fstar] subdir=misc
//! Exercise the bitwise operations

pub fn shift_u32(a: u32) -> u32 {
    let i: usize = 16;
    let mut t = a >> i;
    t <<= i;
    t
}

pub fn shift_i32(a: i32) -> i32 {
    let i: isize = 16;
    let mut t = a >> i;
    t <<= i;
    t
}

pub fn xor_u32(a: u32, b: u32) -> u32 {
    a ^ b
}

pub fn or_u32(a: u32, b: u32) -> u32 {
    a | b
}

pub fn and_u32(a: u32, b: u32) -> u32 {
    a & b
}