svf-tools 1.0.937 → 1.0.939
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/svf/include/AE/Core/AbstractValue.h +6 -287
- package/svf/include/AE/Core/IntervalValue.h +44 -48
- package/svf/include/AE/Core/NumericValue.h +656 -0
- package/svf/include/AE/Core/RelationSolver.h +13 -4
- package/svf/include/AE/Svfexe/AbstractInterpretation.h +6 -6
- package/svf/include/AE/Svfexe/BufOverflowChecker.h +1 -1
- package/svf/include/AE/Svfexe/SVFIR2AbsState.h +2 -2
- package/svf/lib/AE/Core/RelationSolver.cpp +49 -46
- package/svf/lib/AE/Svfexe/AbstractInterpretation.cpp +22 -22
- package/svf/lib/AE/Svfexe/BufOverflowChecker.cpp +21 -21
- package/svf/lib/AE/Svfexe/SVFIR2AbsState.cpp +13 -13
- package/svf-llvm/tools/AE/ae.cpp +12 -12
- package/svf/include/AE/Core/BoundedZ3Expr.h +0 -404
- package/svf/include/AE/Core/NumericLiteral.h +0 -478
- package/svf/lib/AE/Core/BoundedZ3Expr.cpp +0 -64
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.939",
|
|
4
4
|
"description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -168,317 +168,36 @@ public:
|
|
|
168
168
|
AbstractValue(const IntervalValue& ival) : type(IntervalType), interval(ival) {}
|
|
169
169
|
|
|
170
170
|
AbstractValue(const AddressValue& addr) : type(AddressType), addr(addr) {}
|
|
171
|
-
|
|
171
|
+
|
|
172
172
|
IntervalValue& getInterval()
|
|
173
173
|
{
|
|
174
174
|
if (isUnknown())
|
|
175
175
|
{
|
|
176
176
|
interval = IntervalValue::top();
|
|
177
177
|
}
|
|
178
|
-
assert(isInterval());
|
|
178
|
+
assert(isInterval() && "Attempting to retrieve an AbstractValue that is not an Interval!");
|
|
179
179
|
return interval;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
//
|
|
183
182
|
const IntervalValue getInterval() const
|
|
184
183
|
{
|
|
185
|
-
assert(isInterval());
|
|
184
|
+
assert(isInterval() && "Attempting to retrieve an AbstractValue that is not an Interval!");
|
|
186
185
|
return interval;
|
|
187
186
|
}
|
|
188
187
|
|
|
189
188
|
AddressValue& getAddrs()
|
|
190
189
|
{
|
|
191
|
-
assert(isAddr());
|
|
190
|
+
assert(isAddr() && "Attempting to retrieve an AbstractValue that is not an Address!");
|
|
192
191
|
return addr;
|
|
193
192
|
}
|
|
194
193
|
|
|
195
194
|
const AddressValue getAddrs() const
|
|
196
195
|
{
|
|
197
|
-
assert(isAddr());
|
|
196
|
+
assert(isAddr() && "Attempting to retrieve an AbstractValue that is not an Address!");
|
|
198
197
|
return addr;
|
|
199
198
|
}
|
|
200
|
-
~AbstractValue() {};
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
// interval visit funcs
|
|
204
|
-
bool isTop() const
|
|
205
|
-
{
|
|
206
|
-
assert(isInterval());
|
|
207
|
-
return interval.isTop();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
bool isBottom() const
|
|
211
|
-
{
|
|
212
|
-
assert(isInterval());
|
|
213
|
-
return interval.isBottom();
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const NumericLiteral& lb() const
|
|
217
|
-
{
|
|
218
|
-
assert(isInterval());
|
|
219
|
-
return interval.lb();
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const NumericLiteral& ub() const
|
|
223
|
-
{
|
|
224
|
-
assert(isInterval());
|
|
225
|
-
return interval.ub();
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
void setLb(const NumericLiteral& lb)
|
|
229
|
-
{
|
|
230
|
-
assert(isInterval());
|
|
231
|
-
interval.setLb(lb);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
void setUb(const NumericLiteral& ub)
|
|
235
|
-
{
|
|
236
|
-
assert(isInterval());
|
|
237
|
-
interval.setUb(ub);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
void setValue(const NumericLiteral &lb, const NumericLiteral &ub)
|
|
241
|
-
{
|
|
242
|
-
assert(isInterval());
|
|
243
|
-
interval.setValue(lb, ub);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
bool is_zero() const
|
|
247
|
-
{
|
|
248
|
-
assert(isInterval());
|
|
249
|
-
return interval.is_zero();
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
bool is_infinite() const
|
|
253
|
-
{
|
|
254
|
-
assert(isInterval());
|
|
255
|
-
return interval.is_infinite();
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
bool is_int() const
|
|
259
|
-
{
|
|
260
|
-
assert(isInterval());
|
|
261
|
-
return interval.is_int();
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
bool is_real() const
|
|
265
|
-
{
|
|
266
|
-
assert(isInterval());
|
|
267
|
-
return interval.is_real();
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
s64_t getIntNumeral() const
|
|
271
|
-
{
|
|
272
|
-
assert(isInterval());
|
|
273
|
-
return interval.getIntNumeral();
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
double getRealNumeral() const
|
|
277
|
-
{
|
|
278
|
-
assert(isInterval());
|
|
279
|
-
return interval.getRealNumeral();
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
bool is_numeral() const
|
|
283
|
-
{
|
|
284
|
-
assert(isInterval());
|
|
285
|
-
return interval.is_numeral();
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
void set_to_bottom()
|
|
289
|
-
{
|
|
290
|
-
assert(isInterval());
|
|
291
|
-
interval.set_to_bottom();
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
void set_to_top()
|
|
295
|
-
{
|
|
296
|
-
assert(isInterval());
|
|
297
|
-
interval.set_to_top();
|
|
298
|
-
}
|
|
299
199
|
|
|
300
|
-
|
|
301
|
-
{
|
|
302
|
-
assert(isInterval() && other.isInterval());
|
|
303
|
-
return interval.leq(other.interval);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
bool geq(const AbstractValue &other) const
|
|
307
|
-
{
|
|
308
|
-
assert(isInterval() && other.isInterval());
|
|
309
|
-
return interval.geq(other.interval);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
bool contains(s64_t n) const
|
|
313
|
-
{
|
|
314
|
-
assert(isInterval());
|
|
315
|
-
return interval.contains(n);
|
|
316
|
-
}
|
|
317
|
-
// operator +-*/%>< >= <= << >> & | ^
|
|
318
|
-
AbstractValue operator+(const AbstractValue &other) const
|
|
319
|
-
{
|
|
320
|
-
assert(isInterval() && other.isInterval());
|
|
321
|
-
return interval + other.interval;
|
|
322
|
-
}
|
|
323
|
-
AbstractValue operator+(const IntervalValue &other) const
|
|
324
|
-
{
|
|
325
|
-
assert(isInterval());
|
|
326
|
-
return interval + other;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
AbstractValue operator-(const AbstractValue &other) const
|
|
330
|
-
{
|
|
331
|
-
assert(isInterval() && other.isInterval());
|
|
332
|
-
return interval - other.interval;
|
|
333
|
-
}
|
|
334
|
-
AbstractValue operator-(const IntervalValue &other) const
|
|
335
|
-
{
|
|
336
|
-
assert(isInterval());
|
|
337
|
-
return interval - other;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
AbstractValue operator*(const AbstractValue &other) const
|
|
341
|
-
{
|
|
342
|
-
assert(isInterval() && other.isInterval());
|
|
343
|
-
return interval * other.interval;
|
|
344
|
-
}
|
|
345
|
-
AbstractValue operator*(const IntervalValue &other) const
|
|
346
|
-
{
|
|
347
|
-
assert(isInterval());
|
|
348
|
-
return interval * other;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
AbstractValue operator/(const AbstractValue &other) const
|
|
352
|
-
{
|
|
353
|
-
assert(isInterval() && other.isInterval());
|
|
354
|
-
return interval / other.interval;
|
|
355
|
-
}
|
|
356
|
-
AbstractValue operator/(const IntervalValue &other) const
|
|
357
|
-
{
|
|
358
|
-
assert(isInterval());
|
|
359
|
-
return interval / other;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
AbstractValue operator%(const AbstractValue &other) const
|
|
363
|
-
{
|
|
364
|
-
assert(isInterval() && other.isInterval());
|
|
365
|
-
return interval % other.interval;
|
|
366
|
-
}
|
|
367
|
-
AbstractValue operator%(const IntervalValue &other) const
|
|
368
|
-
{
|
|
369
|
-
assert(isInterval());
|
|
370
|
-
return interval % other;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
AbstractValue operator>>(const AbstractValue &other) const
|
|
374
|
-
{
|
|
375
|
-
assert(isInterval() && other.isInterval());
|
|
376
|
-
return interval >> other.interval;
|
|
377
|
-
}
|
|
378
|
-
AbstractValue operator>>(const IntervalValue &other) const
|
|
379
|
-
{
|
|
380
|
-
assert(isInterval());
|
|
381
|
-
return interval >> other;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
AbstractValue operator<<(const AbstractValue &other) const
|
|
385
|
-
{
|
|
386
|
-
assert(isInterval() && other.isInterval());
|
|
387
|
-
return interval << other.interval;
|
|
388
|
-
}
|
|
389
|
-
AbstractValue operator<<(const IntervalValue &other) const
|
|
390
|
-
{
|
|
391
|
-
assert(isInterval());
|
|
392
|
-
return interval << other;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
AbstractValue operator&(const AbstractValue &other) const
|
|
396
|
-
{
|
|
397
|
-
assert(isInterval() && other.isInterval());
|
|
398
|
-
return interval & other.interval;
|
|
399
|
-
}
|
|
400
|
-
AbstractValue operator&(const IntervalValue &other) const
|
|
401
|
-
{
|
|
402
|
-
assert(isInterval());
|
|
403
|
-
return interval & other;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
AbstractValue operator|(const AbstractValue &other) const
|
|
407
|
-
{
|
|
408
|
-
assert(isInterval() && other.isInterval());
|
|
409
|
-
return interval | other.interval;
|
|
410
|
-
}
|
|
411
|
-
AbstractValue operator|(const IntervalValue &other) const
|
|
412
|
-
{
|
|
413
|
-
assert(isInterval());
|
|
414
|
-
return interval | other;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
AbstractValue operator^(const AbstractValue &other) const
|
|
418
|
-
{
|
|
419
|
-
assert(isInterval() && other.isInterval());
|
|
420
|
-
return interval ^ other.interval;
|
|
421
|
-
}
|
|
422
|
-
AbstractValue operator^(const IntervalValue &other) const
|
|
423
|
-
{
|
|
424
|
-
assert(isInterval());
|
|
425
|
-
return interval ^ other;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
AbstractValue operator>(const AbstractValue &other) const
|
|
429
|
-
{
|
|
430
|
-
assert(isInterval() && other.isInterval());
|
|
431
|
-
return interval > other.interval;
|
|
432
|
-
}
|
|
433
|
-
AbstractValue operator>(const IntervalValue &other) const
|
|
434
|
-
{
|
|
435
|
-
assert(isInterval());
|
|
436
|
-
return interval > other;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
AbstractValue operator<(const AbstractValue &other) const
|
|
440
|
-
{
|
|
441
|
-
assert(isInterval() && other.isInterval());
|
|
442
|
-
return interval < other.interval;
|
|
443
|
-
}
|
|
444
|
-
AbstractValue operator<(const IntervalValue &other) const
|
|
445
|
-
{
|
|
446
|
-
assert(isInterval());
|
|
447
|
-
return interval < other;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
AbstractValue operator>=(const AbstractValue &other) const
|
|
451
|
-
{
|
|
452
|
-
assert(isInterval() && other.isInterval());
|
|
453
|
-
return interval >= other.interval;
|
|
454
|
-
}
|
|
455
|
-
AbstractValue operator>=(const IntervalValue &other) const
|
|
456
|
-
{
|
|
457
|
-
assert(isInterval());
|
|
458
|
-
return interval >= other;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
AbstractValue operator<=(const AbstractValue &other) const
|
|
462
|
-
{
|
|
463
|
-
assert(isInterval() && other.isInterval());
|
|
464
|
-
return interval <= other.interval;
|
|
465
|
-
}
|
|
466
|
-
AbstractValue operator<=(const IntervalValue &other) const
|
|
467
|
-
{
|
|
468
|
-
assert(isInterval());
|
|
469
|
-
return interval <= other;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
// address visit funcs
|
|
474
|
-
std::pair<AddressValue::AddrSet::iterator, bool> insertAddr(u32_t id) // insertAddr
|
|
475
|
-
{
|
|
476
|
-
assert(isAddr());
|
|
477
|
-
return addr.insert(id);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// TODO: equals, join_with, meet_with, widen_with, narrow_with, toString,
|
|
481
|
-
// These should be merged with AddressValue
|
|
200
|
+
~AbstractValue() {};
|
|
482
201
|
|
|
483
202
|
bool equals(const AbstractValue &rhs) const
|
|
484
203
|
{
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
#ifndef Z3_EXAMPLE_IntervalValue_H
|
|
32
32
|
#define Z3_EXAMPLE_IntervalValue_H
|
|
33
33
|
|
|
34
|
-
#include "AE/Core/NumericLiteral.h"
|
|
35
34
|
#include <sstream>
|
|
35
|
+
#include "AE/Core/NumericValue.h"
|
|
36
36
|
|
|
37
37
|
namespace SVF
|
|
38
38
|
{
|
|
@@ -44,10 +44,10 @@ class IntervalValue
|
|
|
44
44
|
{
|
|
45
45
|
private:
|
|
46
46
|
// Lower bound
|
|
47
|
-
|
|
47
|
+
BoundedInt _lb;
|
|
48
48
|
|
|
49
49
|
// Upper bound
|
|
50
|
-
|
|
50
|
+
BoundedInt _ub;
|
|
51
51
|
|
|
52
52
|
// Invariant: isBottom() <=> _lb = 1 && _ub = 0
|
|
53
53
|
public:
|
|
@@ -63,18 +63,18 @@ public:
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/// Get minus infinity -oo
|
|
66
|
-
static
|
|
66
|
+
static BoundedInt minus_infinity()
|
|
67
67
|
{
|
|
68
|
-
return
|
|
68
|
+
return BoundedInt::minus_infinity();
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/// Get plus infinity +oo
|
|
72
|
-
static
|
|
72
|
+
static BoundedInt plus_infinity()
|
|
73
73
|
{
|
|
74
|
-
return
|
|
74
|
+
return BoundedInt::plus_infinity();
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
static bool is_infinite(const
|
|
77
|
+
static bool is_infinite(const BoundedInt &e)
|
|
78
78
|
{
|
|
79
79
|
return e.is_infinity();
|
|
80
80
|
}
|
|
@@ -103,16 +103,16 @@ public:
|
|
|
103
103
|
|
|
104
104
|
explicit IntervalValue(double n) : _lb(n), _ub(n) {}
|
|
105
105
|
|
|
106
|
-
explicit IntervalValue(
|
|
106
|
+
explicit IntervalValue(BoundedInt n) : IntervalValue(n, n) {}
|
|
107
107
|
|
|
108
108
|
/// Create the IntervalValue [lb, ub]
|
|
109
|
-
explicit IntervalValue(
|
|
109
|
+
explicit IntervalValue(BoundedInt lb, BoundedInt ub) : _lb(std::move(lb)), _ub(std::move(ub)) {}
|
|
110
110
|
|
|
111
|
-
explicit IntervalValue(s64_t lb, s64_t ub) : IntervalValue(
|
|
111
|
+
explicit IntervalValue(s64_t lb, s64_t ub) : IntervalValue(BoundedInt(lb), BoundedInt(ub)) {}
|
|
112
112
|
|
|
113
|
-
explicit IntervalValue(double lb, double ub) : IntervalValue(
|
|
113
|
+
explicit IntervalValue(double lb, double ub) : IntervalValue(BoundedInt(lb), BoundedInt(ub)) {}
|
|
114
114
|
|
|
115
|
-
explicit IntervalValue(float lb, float ub) : IntervalValue(
|
|
115
|
+
explicit IntervalValue(float lb, float ub) : IntervalValue(BoundedInt(lb), BoundedInt(ub)) {}
|
|
116
116
|
|
|
117
117
|
explicit IntervalValue(s32_t lb, s32_t ub) : IntervalValue((s64_t) lb, (s64_t) ub) {}
|
|
118
118
|
|
|
@@ -203,33 +203,33 @@ public:
|
|
|
203
203
|
~IntervalValue() = default;
|
|
204
204
|
|
|
205
205
|
/// Return the lower bound
|
|
206
|
-
const
|
|
206
|
+
const BoundedInt &lb() const
|
|
207
207
|
{
|
|
208
208
|
assert(!this->isBottom());
|
|
209
209
|
return this->_lb;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
/// Return the upper bound
|
|
213
|
-
const
|
|
213
|
+
const BoundedInt &ub() const
|
|
214
214
|
{
|
|
215
215
|
assert(!this->isBottom());
|
|
216
216
|
return this->_ub;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
/// Set the lower bound
|
|
220
|
-
void setLb(const
|
|
220
|
+
void setLb(const BoundedInt &lb)
|
|
221
221
|
{
|
|
222
222
|
this->_lb = lb;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
/// Set the upper bound
|
|
226
|
-
void setUb(const
|
|
226
|
+
void setUb(const BoundedInt &ub)
|
|
227
227
|
{
|
|
228
228
|
this->_ub = ub;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
/// Set the lower bound
|
|
232
|
-
void setValue(const
|
|
232
|
+
void setValue(const BoundedInt &lb, const BoundedInt &ub)
|
|
233
233
|
{
|
|
234
234
|
this->_lb = lb;
|
|
235
235
|
this->_ub = ub;
|
|
@@ -249,18 +249,14 @@ public:
|
|
|
249
249
|
|
|
250
250
|
bool is_int() const
|
|
251
251
|
{
|
|
252
|
-
|
|
253
|
-
bool ub_int = _ub.is_int();
|
|
254
|
-
assert (lb_int == ub_int && "lb and ub should be both int or both float");
|
|
255
|
-
return _lb.is_int();
|
|
252
|
+
return !is_real();
|
|
256
253
|
}
|
|
257
254
|
|
|
258
255
|
bool is_real() const
|
|
259
256
|
{
|
|
260
257
|
bool lb_real = _lb.is_real();
|
|
261
258
|
bool ub_real = _ub.is_real();
|
|
262
|
-
|
|
263
|
-
return _lb.is_real();
|
|
259
|
+
return lb_real || ub_real;
|
|
264
260
|
}
|
|
265
261
|
|
|
266
262
|
/// Return
|
|
@@ -539,13 +535,13 @@ inline IntervalValue operator*(const IntervalValue &lhs,
|
|
|
539
535
|
}
|
|
540
536
|
else
|
|
541
537
|
{
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
std::vector<
|
|
547
|
-
return IntervalValue(
|
|
548
|
-
|
|
538
|
+
BoundedInt ll = lhs.lb() * rhs.lb();
|
|
539
|
+
BoundedInt lu = lhs.lb() * rhs.ub();
|
|
540
|
+
BoundedInt ul = lhs.ub() * rhs.lb();
|
|
541
|
+
BoundedInt uu = lhs.ub() * rhs.ub();
|
|
542
|
+
std::vector<BoundedDouble> vec{ll, lu, ul, uu};
|
|
543
|
+
return IntervalValue(BoundedInt::min(vec),
|
|
544
|
+
BoundedInt::max(vec));
|
|
549
545
|
}
|
|
550
546
|
}
|
|
551
547
|
|
|
@@ -564,14 +560,14 @@ inline IntervalValue operator/(const IntervalValue &lhs,
|
|
|
564
560
|
else
|
|
565
561
|
{
|
|
566
562
|
// Neither the dividend nor the divisor contains 0
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
std::vector<
|
|
563
|
+
BoundedInt ll = lhs.lb() / rhs.lb();
|
|
564
|
+
BoundedInt lu = lhs.lb() / rhs.ub();
|
|
565
|
+
BoundedInt ul = lhs.ub() / rhs.lb();
|
|
566
|
+
BoundedInt uu = lhs.ub() / rhs.ub();
|
|
567
|
+
std::vector<BoundedDouble> vec{ll, lu, ul, uu};
|
|
572
568
|
|
|
573
|
-
return IntervalValue(
|
|
574
|
-
|
|
569
|
+
return IntervalValue(BoundedInt::min(vec),
|
|
570
|
+
BoundedInt::max(vec));
|
|
575
571
|
}
|
|
576
572
|
}
|
|
577
573
|
|
|
@@ -593,9 +589,9 @@ inline IntervalValue operator%(const IntervalValue &lhs,
|
|
|
593
589
|
}
|
|
594
590
|
else
|
|
595
591
|
{
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
592
|
+
BoundedInt n_ub = max(abs(lhs.lb()), abs(lhs.ub()));
|
|
593
|
+
BoundedInt d_ub = max(abs(rhs.lb()), rhs.ub()) - 1;
|
|
594
|
+
BoundedInt ub = min(n_ub, d_ub);
|
|
599
595
|
|
|
600
596
|
if (lhs.lb().getNumeral() < 0)
|
|
601
597
|
{
|
|
@@ -864,13 +860,13 @@ inline IntervalValue operator>>(const IntervalValue &lhs, const IntervalValue &r
|
|
|
864
860
|
}
|
|
865
861
|
else
|
|
866
862
|
{
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
std::vector<
|
|
872
|
-
return IntervalValue(
|
|
873
|
-
|
|
863
|
+
BoundedInt ll = lhs.lb() >> shift.lb();
|
|
864
|
+
BoundedInt lu = lhs.lb() >> shift.ub();
|
|
865
|
+
BoundedInt ul = lhs.ub() >> shift.lb();
|
|
866
|
+
BoundedInt uu = lhs.ub() >> shift.ub();
|
|
867
|
+
std::vector<BoundedDouble> vec{ll, lu, ul, uu};
|
|
868
|
+
return IntervalValue(BoundedInt::min(vec),
|
|
869
|
+
BoundedInt::max(vec));
|
|
874
870
|
}
|
|
875
871
|
}
|
|
876
872
|
}
|