diff options
author | Aymeric Fromherz | 2024-05-24 15:02:26 +0200 |
---|---|---|
committer | Aymeric Fromherz | 2024-05-24 15:02:26 +0200 |
commit | 4d33ea68ca1ebfca35b7d7332f63b74dd3c06838 (patch) | |
tree | 838da53ae7e5be27e1dde684d0354a5ce2a1fd99 /tests/src/bitwise.rs | |
parent | ac5f261997079002a782217ebf0c854e31bb880d (diff) | |
parent | 3c8ea6df20f92be9c341bbfb748f65d6c598fead (diff) |
Merge remote-tracking branch 'origin/main' into afromher_debug
Diffstat (limited to 'tests/src/bitwise.rs')
-rw-r--r-- | tests/src/bitwise.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/src/bitwise.rs b/tests/src/bitwise.rs new file mode 100644 index 00000000..9f48cb04 --- /dev/null +++ b/tests/src/bitwise.rs @@ -0,0 +1,27 @@ +//! 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 +} |