uint64.zy 587 B

123456789101112131415161718192021222324252627282930313233
  1. // Max uint64 value, will overflow an int64
  2. {x := 18446744073709551615ULL}
  3. (assert (== 0ULL (+ 1ULL x))) // wrap around
  4. // hex
  5. {h := 0xffULL } // == 255 decimal
  6. // octal
  7. {o := 0o70ULL } // == 56 decimal
  8. // equality and addition work
  9. (assert (== 311ULL (+ h o)))
  10. // subtraction works
  11. (assert (== 199ULL (- h o)))
  12. // multiplication
  13. (assert (== 14280ULL (* h o)))
  14. {d := 0o377ULL}
  15. // asUint64 conversion
  16. (assert (== d (asUint64 {3*64 + 7*8 + 7}))) // == 255 decimal
  17. // type
  18. (assert (== (type? h) "uint64"))
  19. (assert (== (type? d) "uint64"))
  20. // division
  21. (assert (== 1ULL (/ h d)))