Files
mercury/tests/hard_coded/rotate_uint32.exp
Julien Fischer 9e58712489 Add bitwise rotations for uint32s.
library/uint32.m:
    As above.

tests/hard_coded/Mmakefile:
tests/hard_coded/rotate_uint32.{m,exp}:
    Add a test for the new operations.
2021-03-28 14:28:22 +11:00

89 lines
5.1 KiB
Plaintext

*** Test 'rotate_left' ***
rotate_left(00000000000000000000000000000001, 0) = 00000000000000000000000000000001
unchecked_rotate_left(00000000000000000000000000000001, 0) = 00000000000000000000000000000001
rotate_left(00000000000000000000000000000001, 1) = 00000000000000000000000000000010
unchecked_rotate_left(00000000000000000000000000000001, 1) = 00000000000000000000000000000010
rotate_left(00000000000000000000000000000001, 2) = 00000000000000000000000000000100
unchecked_rotate_left(00000000000000000000000000000001, 2) = 00000000000000000000000000000100
rotate_left(00000000000000000000000000000001, 31) = 10000000000000000000000000000000
unchecked_rotate_left(00000000000000000000000000000001, 31) = 10000000000000000000000000000000
rotate_left(00000000000000000000000000000001, 32) = <<exception>>
unchecked_rotate_left(00000000000000000000000000000001, 32) = 00000000000000000000000000000001
rotate_left(00000000000000000000000000000001, 63) = <<exception>>
unchecked_rotate_left(00000000000000000000000000000001, 63) = 10000000000000000000000000000000
rotate_left(00000000000000000000000000000001, 64) = <<exception>>
unchecked_rotate_left(00000000000000000000000000000001, 64) = 00000000000000000000000000000001
rotate_left(00000000000000000000000011111111, 0) = 00000000000000000000000011111111
unchecked_rotate_left(00000000000000000000000011111111, 0) = 00000000000000000000000011111111
rotate_left(00000000000000000000000011111111, 1) = 00000000000000000000000111111110
unchecked_rotate_left(00000000000000000000000011111111, 1) = 00000000000000000000000111111110
rotate_left(00000000000000000000000011111111, 2) = 00000000000000000000001111111100
unchecked_rotate_left(00000000000000000000000011111111, 2) = 00000000000000000000001111111100
rotate_left(00000000000000000000000011111111, 31) = 10000000000000000000000001111111
unchecked_rotate_left(00000000000000000000000011111111, 31) = 10000000000000000000000001111111
rotate_left(00000000000000000000000011111111, 32) = <<exception>>
unchecked_rotate_left(00000000000000000000000011111111, 32) = 00000000000000000000000011111111
rotate_left(00000000000000000000000011111111, 63) = <<exception>>
unchecked_rotate_left(00000000000000000000000011111111, 63) = 10000000000000000000000001111111
rotate_left(00000000000000000000000011111111, 64) = <<exception>>
unchecked_rotate_left(00000000000000000000000011111111, 64) = 00000000000000000000000011111111
*** Test 'rotate_right' ***
rotate_right(00000000000000000000000000000001, 0) = 00000000000000000000000000000001
unchecked_rotate_right(00000000000000000000000000000001, 0) = 00000000000000000000000000000001
rotate_right(00000000000000000000000000000001, 1) = 10000000000000000000000000000000
unchecked_rotate_right(00000000000000000000000000000001, 1) = 10000000000000000000000000000000
rotate_right(00000000000000000000000000000001, 2) = 01000000000000000000000000000000
unchecked_rotate_right(00000000000000000000000000000001, 2) = 01000000000000000000000000000000
rotate_right(00000000000000000000000000000001, 31) = 00000000000000000000000000000010
unchecked_rotate_right(00000000000000000000000000000001, 31) = 00000000000000000000000000000010
rotate_right(00000000000000000000000000000001, 32) = <<exception>>
unchecked_rotate_right(00000000000000000000000000000001, 32) = 00000000000000000000000000000001
rotate_right(00000000000000000000000000000001, 63) = <<exception>>
unchecked_rotate_right(00000000000000000000000000000001, 63) = 00000000000000000000000000000010
rotate_right(00000000000000000000000000000001, 64) = <<exception>>
unchecked_rotate_right(00000000000000000000000000000001, 64) = 00000000000000000000000000000001
rotate_right(00000000000000000000000011111111, 0) = 00000000000000000000000011111111
unchecked_rotate_right(00000000000000000000000011111111, 0) = 00000000000000000000000011111111
rotate_right(00000000000000000000000011111111, 1) = 10000000000000000000000001111111
unchecked_rotate_right(00000000000000000000000011111111, 1) = 10000000000000000000000001111111
rotate_right(00000000000000000000000011111111, 2) = 11000000000000000000000000111111
unchecked_rotate_right(00000000000000000000000011111111, 2) = 11000000000000000000000000111111
rotate_right(00000000000000000000000011111111, 31) = 00000000000000000000000111111110
unchecked_rotate_right(00000000000000000000000011111111, 31) = 00000000000000000000000111111110
rotate_right(00000000000000000000000011111111, 32) = <<exception>>
unchecked_rotate_right(00000000000000000000000011111111, 32) = 00000000000000000000000011111111
rotate_right(00000000000000000000000011111111, 63) = <<exception>>
unchecked_rotate_right(00000000000000000000000011111111, 63) = 00000000000000000000000111111110
rotate_right(00000000000000000000000011111111, 64) = <<exception>>
unchecked_rotate_right(00000000000000000000000011111111, 64) = 00000000000000000000000011111111