tbitops_utils.nim 349 B

1234567891011121314151617181920
  1. discard """
  2. matrix: "--mm:refc; --mm:orc"
  3. """
  4. import std/private/bitops_utils
  5. import std/assertions
  6. template chk(a, b) =
  7. let a2 = castToUnsigned(a)
  8. doAssert a2 == b
  9. doAssert type(a2) is type(b)
  10. doAssert type(b) is type(a2)
  11. chk 1'i8, 1'u8
  12. chk -1'i8, 255'u8
  13. chk 1'u8, 1'u8
  14. chk 1'u, 1'u
  15. chk -1, cast[uint](-1)
  16. chk -1'i64, cast[uint64](-1)