Files
mercury/tests/hard_coded/uint64_uint8_casts.exp
Julien Fischer a3b882930f Add casts to and from uint{16,32,64} and uint8.
While these casts can be implemented by casting via uint, the resulting code is
less readable than code that uses direct casts.

library/uint16.m:
library/uint32.m:
library/uint64.m:
    Add cast_from_uint8/1 and cast_to_uint8/1 to these modules.

NEWS:
    Announce the above additions.

tests/hard_coded/Mmakefile:
tests/hard_coded/uint{16,32,64}_uint_casts.{m,exp}:
    Add tests for the new casts.
2021-11-13 15:09:25 +11:00

28 lines
759 B
Plaintext

cast_from_uint8(0u8) = 0u64
cast_from_uint8(7u8) = 7u64
cast_from_uint8(8u8) = 8u64
cast_from_uint8(15u8) = 15u64
cast_from_uint8(16u8) = 16u64
cast_from_uint8(31u8) = 31u64
cast_from_uint8(32u8) = 32u64
cast_from_uint8(63u8) = 63u64
cast_from_uint8(64u8) = 64u64
cast_from_uint8(127u8) = 127u64
cast_from_uint8(128u8) = 128u64
cast_from_uint8(254u8) = 254u64
cast_from_uint8(255u8) = 255u64
cast_to_uint8(0u64) = 0u8
cast_to_uint8(7u64) = 7u8
cast_to_uint8(8u64) = 8u8
cast_to_uint8(15u64) = 15u8
cast_to_uint8(16u64) = 16u8
cast_to_uint8(31u64) = 31u8
cast_to_uint8(32u64) = 32u8
cast_to_uint8(63u64) = 63u8
cast_to_uint8(64u64) = 64u8
cast_to_uint8(127u64) = 127u8
cast_to_uint8(128u64) = 128u8
cast_to_uint8(254u64) = 254u8
cast_to_uint8(255u64) = 255u8