From ef3ce824f87fd11eed78a13a884579499a8ffc53 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Tue, 2 Apr 2019 17:51:17 -0400 Subject: Add Z.combine_at_bitwidth --- src/Util/ZUtil/Definitions.v | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Util/ZUtil/Definitions.v') diff --git a/src/Util/ZUtil/Definitions.v b/src/Util/ZUtil/Definitions.v index 8fe5772f5..a5ac1a95b 100644 --- a/src/Util/ZUtil/Definitions.v +++ b/src/Util/ZUtil/Definitions.v @@ -85,6 +85,9 @@ Module Z. then mul_split_at_bitwidth (Z.log2 s) x y else ((x * y) mod s, (x * y) / s). + Definition combine_at_bitwidth (bitwidth lo hi : Z) : Z + := lo + (hi << bitwidth). + (** if positive, round up to 2^k-1 (0b11111....); if negative, round down to -2^k (0b...111000000...) *) Definition round_lor_land_bound (x : Z) : Z := if (0 <=? x)%Z -- cgit v1.2.3