summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2018-02-23 18:02:53 -0800
committerGitHub <noreply@github.com>2018-02-23 18:02:53 -0800
commitcb8e3b305ecf83cde0380f9198fa6d3f795362cd (patch)
treecbae726a0df059c89bdbfaaf36fcb3f356e7d298 /src/util
parentcef98b9c073c6c1a1535f4f45589a86cfaab1c33 (diff)
Add unit tests for BitVector, minor BV rewrite fix (#1622)
This commit adds unit tests for the BitVector class and adds some additional argument checks. Additionally, it fixes a minor issue in the ZeroExtendUltConst rule if the zero_extend was by 0 bits. In that case, the rule was calling BitVector::extract() with high < low.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/bitvector.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/util/bitvector.cpp b/src/util/bitvector.cpp
index 2d94be875..549c94dc9 100644
--- a/src/util/bitvector.cpp
+++ b/src/util/bitvector.cpp
@@ -90,6 +90,8 @@ BitVector BitVector::concat(const BitVector& other) const
BitVector BitVector::extract(unsigned high, unsigned low) const
{
+ CheckArgument(high < d_size, high);
+ CheckArgument(low <= high, low);
return BitVector(high - low + 1,
d_value.extractBitRange(high - low + 1, low));
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback