diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a81b985b3..9f17ed40bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -91,6 +91,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * Variables used as implicit fields in a record construction are now properly recognised as being used. + * futlib: the `num_bits` field for the integer modules in `math` now + have correct values. + ## [0.2.0] ### Added diff --git a/futlib/math.fut b/futlib/math.fut index 13f6bfd05b..f98beea45a 100644 --- a/futlib/math.fut +++ b/futlib/math.fut @@ -261,7 +261,7 @@ module i16: (size with t = i16) = { let max (x: t) (y: t) = intrinsics.smax16 x y let min (x: t) (y: t) = intrinsics.smin16 x y - let num_bits = 8 + let num_bits = 16 let get_bit (bit: i32) (x: t) = to_i32 ((x >> i32 bit) & i32 1) let set_bit (bit: i32) (x: t) (b: i32) = ((x & i32 (intrinsics.~(1 intrinsics.<< b))) | x intrinsics.<< i32 b) @@ -326,7 +326,7 @@ module i32: (size with t = i32) = { let max (x: t) (y: t) = intrinsics.smax32 x y let min (x: t) (y: t) = intrinsics.smin32 x y - let num_bits = 8 + let num_bits = 32 let get_bit (bit: i32) (x: t) = to_i32 ((x >> i32 bit) & i32 1) let set_bit (bit: i32) (x: t) (b: i32) = ((x & i32 (intrinsics.~(1 intrinsics.<< b))) | x intrinsics.<< i32 b) @@ -391,7 +391,7 @@ module i64: (size with t = i64) = { let max (x: t) (y: t) = intrinsics.smax64 x y let min (x: t) (y: t) = intrinsics.smin64 x y - let num_bits = 8 + let num_bits = 64 let get_bit (bit: i32) (x: t) = to_i32 ((x >> i32 bit) & i32 1) let set_bit (bit: i32) (x: t) (b: i32) = ((x & i32 (intrinsics.~(1 intrinsics.<< b))) | x intrinsics.<< i32 b) @@ -521,7 +521,7 @@ module u16: (size with t = u16) = { let max (x: t) (y: t) = unsign (intrinsics.umax16 (sign x) (sign y)) let min (x: t) (y: t) = unsign (intrinsics.umin16 (sign x) (sign y)) - let num_bits = 8 + let num_bits = 16 let get_bit (bit: i32) (x: t) = to_i32 ((x >> i32 bit) & i32 1) let set_bit (bit: i32) (x: t) (b: i32) = ((x & i32 (intrinsics.~(1 intrinsics.<< b))) | x intrinsics.<< i32 b) @@ -586,7 +586,7 @@ module u32: (size with t = u32) = { let max (x: t) (y: t) = unsign (intrinsics.umax32 (sign x) (sign y)) let min (x: t) (y: t) = unsign (intrinsics.umin32 (sign x) (sign y)) - let num_bits = 8 + let num_bits = 32 let get_bit (bit: i32) (x: t) = to_i32 ((x >> i32 bit) & i32 1) let set_bit (bit: i32) (x: t) (b: i32) = ((x & i32 (intrinsics.~(1 intrinsics.<< b))) | x intrinsics.<< i32 b) @@ -651,7 +651,7 @@ module u64: (size with t = u64) = { let max (x: t) (y: t) = unsign (intrinsics.umax64 (sign x) (sign y)) let min (x: t) (y: t) = unsign (intrinsics.umin64 (sign x) (sign y)) - let num_bits = 8 + let num_bits = 64 let get_bit (bit: i32) (x: t) = to_i32 ((x >> i32 bit) & i32 1) let set_bit (bit: i32) (x: t) (b: i32) = ((x & i32 (intrinsics.~(1 intrinsics.<< b))) | x intrinsics.<< i32 b)