aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy GALLIUM <xleroy@power7.inria.fr>2014-11-25 19:29:32 +0100
committerXavier Leroy GALLIUM <xleroy@power7.inria.fr>2014-11-25 19:29:32 +0100
commit1ccc058794381d7d7c2ff704786009019489001d (patch)
tree4d56c4837271187d8b80394b1c2302129cd43b3b
parent52f9c87dca61ca00fc9cd9944e530ea63ab3a477 (diff)
downloadcompcert-kvx-1ccc058794381d7d7c2ff704786009019489001d.tar.gz
compcert-kvx-1ccc058794381d7d7c2ff704786009019489001d.zip
Use Bitstring.is_zeroes_bitstring from bitstring 2.0.4.
The original code is less efficient and not tail recursive.
-rw-r--r--checklink/Bitstring_utils.ml8
1 files changed, 8 insertions, 0 deletions
diff --git a/checklink/Bitstring_utils.ml b/checklink/Bitstring_utils.ml
index 2253b63f..3218f898 100644
--- a/checklink/Bitstring_utils.ml
+++ b/checklink/Bitstring_utils.ml
@@ -9,6 +9,13 @@ type bitstring = Bitstring.bitstring
bitstring may be longer.
@param size number of bits to check
*)
+
+let is_zeros (bs: bitstring) (size: int): bool =
+ Bitstring.bitstring_length bs >= size
+ && Bitstring.is_zeroes_bitstring (Bitstring.subbitstring bs 0 size)
+
+(*
+
let rec is_zeros (bs: bitstring) (size: int): bool =
size = 0 ||
if size >= 64
@@ -23,3 +30,4 @@ let rec is_zeros (bs: bitstring) (size: int): bool =
| { 0L : size : int } -> true
| { _ } -> false
)
+*)