summaryrefslogtreecommitdiff
path: root/tests/src/bitwise.rs
blob: fda8eff3f9068e9e41e6f1bdd6d7d979b2fc7650 (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
//@ 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
}