summaryrefslogtreecommitdiff
path: root/src/util/bitvector.h
diff options
context:
space:
mode:
authorlianah <lianahady@gmail.com>2013-02-01 19:43:37 -0500
committerlianah <lianahady@gmail.com>2013-02-01 19:43:37 -0500
commit764bda53ed154495286d7ff117aa7182a8ce5f7b (patch)
treead0466a34055b19b1d91e0590415f7e93cee8f27 /src/util/bitvector.h
parentf0988a89ecc0e5f2995dc8d390b5e9df2fa5421f (diff)
parent8c5e895525ec87ba0285c281b45144eab79b66f9 (diff)
merged master into branch
Diffstat (limited to 'src/util/bitvector.h')
-rw-r--r--src/util/bitvector.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/util/bitvector.h b/src/util/bitvector.h
index 5df632ff4..c9661c0c7 100644
--- a/src/util/bitvector.h
+++ b/src/util/bitvector.h
@@ -190,22 +190,27 @@ public:
return d_value.isBitSet(i);
}
- BitVector unsignedDiv (const BitVector& y) const {
+ /**
+ * Total division function that returns 0 when the denominator is 0.
+ */
+ BitVector unsignedDivTotal (const BitVector& y) const {
+
CheckArgument(d_size == y.d_size, y);
- // TODO: decide whether we really want these semantics
if (y.d_value == 0) {
- return BitVector(d_size, Integer(0));
+ return BitVector(d_size, 0u);
}
CheckArgument(d_value >= 0, this);
CheckArgument(y.d_value > 0, y);
return BitVector(d_size, d_value.floorDivideQuotient(y.d_value));
}
-
- BitVector unsignedRem(const BitVector& y) const {
+
+ /**
+ * Total division function that returns 0 when the denominator is 0.
+ */
+ BitVector unsignedRemTotal(const BitVector& y) const {
CheckArgument(d_size == y.d_size, y);
- // TODO: decide whether we really want these semantics
if (y.d_value == 0) {
- return BitVector(d_size, d_value);
+ return BitVector(d_size, 0u);
}
CheckArgument(d_value >= 0, this);
CheckArgument(y.d_value > 0, y);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback