Update sorted_interval_list
This commit is contained in:
@@ -371,12 +371,20 @@ Domain Domain::MultiplicationBy(int64 coeff, bool* exact) const {
|
||||
|
||||
Domain result;
|
||||
if (abs_coeff > 1) {
|
||||
const int64 max_value = kint64max / abs_coeff;
|
||||
const int64 min_value = kint64min / abs_coeff;
|
||||
result.intervals_.reserve(size_if_non_trivial);
|
||||
for (const ClosedInterval& i : intervals_) {
|
||||
for (int v = i.start; v <= i.end; ++v) {
|
||||
// Because abs_coeff > 1, all new values are disjoint.
|
||||
const int64 new_value = CapProd(v, abs_coeff);
|
||||
result.intervals_.push_back({new_value, new_value});
|
||||
for (int64 v = i.start;; ++v) {
|
||||
// We ignore anything that overflow.
|
||||
if (v >= min_value && v <= max_value) {
|
||||
// Because abs_coeff > 1, all new values are disjoint.
|
||||
const int64 new_value = v * abs_coeff;
|
||||
result.intervals_.push_back({new_value, new_value});
|
||||
}
|
||||
|
||||
// This is to avoid doing ++v when v is kint64max!
|
||||
if (v == i.end) break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -238,6 +238,9 @@ class Domain {
|
||||
* coeff, the size of intervals.size() can become really large. If it is
|
||||
* larger than a fixed constant, exact will be set to false and the result
|
||||
* will be set to ContinuousMultiplicationBy(coeff).
|
||||
*
|
||||
* Note that if you multiply by a negative coeff, kint64min will be dropped
|
||||
* from the result even if it was here due to how this is implemented.
|
||||
*/
|
||||
Domain MultiplicationBy(int64 coeff, bool* exact = nullptr) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user