Skip to content

Commit

Permalink
Fix num_bits fields. Oops.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Feb 1, 2018
1 parent cd1eb7e commit 81b858a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions futlib/math.fut
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 81b858a

Please sign in to comment.