Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::BoundedInt Class Reference

A class representing a bounded 64-bit integer. More...

#include <NumericValue.h>

Public Member Functions

 BoundedInt (s64_t fVal)
 BoundedInt (s64_t fVal, bool isInf)
 BoundedInt (const BoundedInt &rhs)
BoundedInt & operator= (const BoundedInt &rhs)
 BoundedInt (BoundedInt &&rhs)
BoundedInt & operator= (BoundedInt &&rhs)
virtual ~BoundedInt ()
bool is_plus_infinity () const
bool is_minus_infinity () const
bool is_infinity () const
void set_plus_infinity ()
void set_minus_infinity ()
bool is_zero () const
bool equal (const BoundedInt &rhs) const
bool leq (const BoundedInt &rhs) const
bool geq (const BoundedInt &rhs) const
bool is_true () const
s64_t getNumeral () const
 Retrieves the numeral value of the BoundedInt object.
virtual const std::string to_string () const
bool is_real () const
s64_t getIntNumeral () const
double getRealNumeral () const
const double getFVal () const

Static Public Member Functions

static BoundedInt plus_infinity ()
static BoundedInt minus_infinity ()
static bool isZero (const BoundedInt &expr)
static BoundedInt safeNeg (const BoundedInt &value)
static BoundedInt safeAdd (const BoundedInt &lhs, const BoundedInt &rhs)
static BoundedInt safeSub (const BoundedInt &lhs, const BoundedInt &rhs)
static BoundedInt safeMul (const BoundedInt &lhs, const BoundedInt &rhs)
static BoundedInt safeDiv (const BoundedInt &lhs, const BoundedInt &rhs)
static BoundedInt safeRem (const BoundedInt &lhs, const BoundedInt &rhs)
static BoundedInt min (std::vector< BoundedInt > &_l)
static BoundedInt max (std::vector< BoundedInt > &_l)

Protected Member Functions

 BoundedInt ()=default

Protected Attributes

s64_t _iVal
bool _isInf

Friends

bool operator== (const BoundedInt &lhs, const BoundedInt &rhs)
 Reload operator.
bool operator!= (const BoundedInt &lhs, const BoundedInt &rhs)
bool operator> (const BoundedInt &lhs, const BoundedInt &rhs)
bool operator< (const BoundedInt &lhs, const BoundedInt &rhs)
bool operator<= (const BoundedInt &lhs, const BoundedInt &rhs)
bool operator>= (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator- (const BoundedInt &value)
BoundedInt operator+ (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator- (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator* (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator/ (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator% (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator^ (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator& (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator| (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator&& (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator|| (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator! (const BoundedInt &lhs)
BoundedInt operator>> (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt operator<< (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt ite (const BoundedInt &cond, const BoundedInt &lhs, const BoundedInt &rhs)
std::ostream & operator<< (std::ostream &out, const BoundedInt &expr)
bool eq (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt min (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt max (const BoundedInt &lhs, const BoundedInt &rhs)
BoundedInt abs (const BoundedInt &lhs)

Detailed Description

A class representing a bounded 64-bit integer.

BoundedInt is a class that represents a 64-bit integer that can also represent positive and negative infinity. It includes a 64-bit integer value and a boolean flag indicating whether the value is infinite. If the value is infinite, the integer value is used to represent the sign of infinity (1 for positive infinity and -1 for negative infinity).

Definition at line 57 of file NumericValue.h.

Constructor & Destructor Documentation

◆ BoundedInt() [1/5]

SVF::BoundedInt::BoundedInt ( )
protecteddefault

◆ BoundedInt() [2/5]

SVF::BoundedInt::BoundedInt ( s64_t fVal)
inline

Definition at line 72 of file NumericValue.h.

72: _iVal(fVal), _isInf(false) {}

◆ BoundedInt() [3/5]

SVF::BoundedInt::BoundedInt ( s64_t fVal,
bool isInf )
inline

Definition at line 76 of file NumericValue.h.

76: _iVal(fVal), _isInf(isInf) {}

◆ BoundedInt() [4/5]

SVF::BoundedInt::BoundedInt ( const BoundedInt & rhs)
inline

Definition at line 79 of file NumericValue.h.

79: _iVal(rhs._iVal), _isInf(rhs._isInf) {}

◆ BoundedInt() [5/5]

SVF::BoundedInt::BoundedInt ( BoundedInt && rhs)
inline

Definition at line 90 of file NumericValue.h.

90: _iVal(rhs._iVal), _isInf(rhs._isInf) {}

◆ ~BoundedInt()

virtual SVF::BoundedInt::~BoundedInt ( )
inlinevirtual

Definition at line 101 of file NumericValue.h.

101{}

Member Function Documentation

◆ equal()

bool SVF::BoundedInt::equal ( const BoundedInt & rhs) const
inline

Definition at line 158 of file NumericValue.h.

159 {
160 return _iVal == rhs._iVal && _isInf == rhs._isInf;
161 }

◆ geq()

bool SVF::BoundedInt::geq ( const BoundedInt & rhs) const
inline

Definition at line 192 of file NumericValue.h.

193 {
194 // If only one of the two BoundedInts is infinite.
195 if (is_infinity() ^ rhs.is_infinity())
196 {
197 if (is_infinity())
198 {
199 return is_plus_infinity();
200 }
201 else
202 {
203 return rhs.is_minus_infinity();
204 }
205 }
206 // If both BoundedInts are infinite.
207 if (is_infinity() && rhs.is_infinity())
208 {
209 if (is_plus_infinity())
210 return true;
211 else
212 return rhs.is_minus_infinity();
213 }
214 // If neither BoundedInt is infinite.
215 else
216 return _iVal >= rhs._iVal;
217 }
bool is_plus_infinity() const
bool is_infinity() const

◆ getFVal()

const double SVF::BoundedInt::getFVal ( ) const
inline

Definition at line 694 of file NumericValue.h.

695 {
696 assert(false && "cannot get real number for integer!");
697 abort();
698 }

◆ getIntNumeral()

s64_t SVF::BoundedInt::getIntNumeral ( ) const
inline

Definition at line 683 of file NumericValue.h.

684 {
685 return getNumeral();
686 }
s64_t getNumeral() const
Retrieves the numeral value of the BoundedInt object.

◆ getNumeral()

s64_t SVF::BoundedInt::getNumeral ( ) const
inline

Retrieves the numeral value of the BoundedInt object.

This method returns the numeral representation of the BoundedInt object. If the object represents negative infinity, it returns the minimum representable 64-bit integer. If the object represents positive infinity, it returns the maximum representable 64-bit integer. Otherwise, it returns the actual 64-bit integer value of the object.

Returns
The numeral value of the BoundedInt object.

Definition at line 641 of file NumericValue.h.

642 {
643 // If the object represents negative infinity, return the minimum
644 // representable 64-bit integer.
645 if (is_minus_infinity())
646 {
647 return std::numeric_limits<s64_t>::min();
648 }
649 // If the object represents positive infinity, return the maximum
650 // representable 64-bit integer.
651 else if (is_plus_infinity())
652 {
653 return std::numeric_limits<s64_t>::max();
654 }
655 // Otherwise, return the actual 64-bit integer value of the object.
656 else
657 {
658 return _iVal;
659 }
660 }
bool is_minus_infinity() const

◆ getRealNumeral()

double SVF::BoundedInt::getRealNumeral ( ) const
inline

Definition at line 688 of file NumericValue.h.

689 {
690 assert(false && "cannot get real number for integer!");
691 abort();
692 }

◆ is_infinity()

bool SVF::BoundedInt::is_infinity ( ) const
inline

Definition at line 116 of file NumericValue.h.

117 {
119 }

◆ is_minus_infinity()

bool SVF::BoundedInt::is_minus_infinity ( ) const
inline

Definition at line 110 of file NumericValue.h.

111 {
112 return _isInf && _iVal == -1;
113 }

◆ is_plus_infinity()

bool SVF::BoundedInt::is_plus_infinity ( ) const
inline

Definition at line 104 of file NumericValue.h.

105 {
106 return _isInf && _iVal == 1;
107 }

◆ is_real()

bool SVF::BoundedInt::is_real ( ) const
inline

Definition at line 678 of file NumericValue.h.

679 {
680 return false;
681 }

◆ is_true()

bool SVF::BoundedInt::is_true ( ) const
inline

Definition at line 625 of file NumericValue.h.

626 {
627 return _iVal != 0;
628 }

◆ is_zero()

bool SVF::BoundedInt::is_zero ( ) const
inline

Definition at line 146 of file NumericValue.h.

147 {
148 return _iVal == 0;
149 }

◆ isZero()

bool SVF::BoundedInt::isZero ( const BoundedInt & expr)
inlinestatic

Definition at line 152 of file NumericValue.h.

153 {
154 return expr._iVal == 0;
155 }

◆ leq()

bool SVF::BoundedInt::leq ( const BoundedInt & rhs) const
inline

Definition at line 164 of file NumericValue.h.

165 {
166 // If only one of the two BoundedInts is infinite.
167 if (is_infinity() ^ rhs.is_infinity())
168 {
169 if (is_infinity())
170 {
171 return is_minus_infinity();
172 }
173 else
174 {
175 return rhs.is_plus_infinity();
176 }
177 }
178 // If both BoundedInts are infinite.
179 if (is_infinity() && rhs.is_infinity())
180 {
181 if (is_minus_infinity())
182 return true;
183 else
184 return rhs.is_plus_infinity();
185 }
186 // If neither BoundedInt is infinite.
187 else
188 return _iVal <= rhs._iVal;
189 }

◆ max()

BoundedInt SVF::BoundedInt::max ( std::vector< BoundedInt > & _l)
inlinestatic

Definition at line 599 of file NumericValue.h.

600 {
602 for (const auto& it : _l)
603 {
604 if (it.is_plus_infinity())
605 return plus_infinity();
606 else if (!it.leq(ret))
607 {
608 ret = it;
609 }
610 }
611 return ret;
612 }
BoundedInt()=default
static BoundedInt plus_infinity()
static BoundedInt minus_infinity()

◆ min()

BoundedInt SVF::BoundedInt::min ( std::vector< BoundedInt > & _l)
inlinestatic

Definition at line 581 of file NumericValue.h.

582 {
584 for (const auto& it : _l)
585 {
586 if (it.is_minus_infinity())
587 return minus_infinity();
588 else if (!it.geq(ret))
589 {
590 ret = it;
591 }
592 }
593 return ret;
594 }

◆ minus_infinity()

BoundedInt SVF::BoundedInt::minus_infinity ( )
inlinestatic

Definition at line 140 of file NumericValue.h.

141 {
142 return {-1, true};
143 }

◆ operator=() [1/2]

BoundedInt & SVF::BoundedInt::operator= ( BoundedInt && rhs)
inline

Definition at line 93 of file NumericValue.h.

94 {
95 _iVal = rhs._iVal;
96 _isInf = rhs._isInf;
97 return *this;
98 }

◆ operator=() [2/2]

BoundedInt & SVF::BoundedInt::operator= ( const BoundedInt & rhs)
inline

Definition at line 82 of file NumericValue.h.

83 {
84 _iVal = rhs._iVal;
85 _isInf = rhs._isInf;
86 return *this;
87 }

◆ plus_infinity()

BoundedInt SVF::BoundedInt::plus_infinity ( )
inlinestatic

Definition at line 134 of file NumericValue.h.

135 {
136 return {1, true};
137 }

◆ safeAdd()

BoundedInt SVF::BoundedInt::safeAdd ( const BoundedInt & lhs,
const BoundedInt & rhs )
inlinestatic

Definition at line 294 of file NumericValue.h.

295 {
296 if ((lhs.is_plus_infinity() && rhs.is_minus_infinity()) ||
297 (lhs.is_minus_infinity() && rhs.is_plus_infinity()))
298 {
299 assert(false && "invalid add");
300 abort();
301 }
302 if (lhs.is_plus_infinity() || rhs.is_plus_infinity())
303 return plus_infinity();
304 if (lhs.is_minus_infinity() || rhs.is_minus_infinity())
305 return minus_infinity();
306
307 const s64_t min = std::numeric_limits<s64_t>::min();
308 const s64_t max = std::numeric_limits<s64_t>::max();
309 if (rhs._iVal > 0 && lhs._iVal > max - rhs._iVal)
310 return plus_infinity();
311 if (rhs._iVal < 0 && lhs._iVal < min - rhs._iVal)
312 return minus_infinity();
313 return lhs._iVal + rhs._iVal;
314 }
friend BoundedInt max(const BoundedInt &lhs, const BoundedInt &rhs)
friend BoundedInt min(const BoundedInt &lhs, const BoundedInt &rhs)
signed long long s64_t
Definition GeneralType.h:70

◆ safeDiv()

BoundedInt SVF::BoundedInt::safeDiv ( const BoundedInt & lhs,
const BoundedInt & rhs )
inlinestatic

Definition at line 368 of file NumericValue.h.

369 {
370 if (rhs.is_zero())
371 {
372 assert(false && "divide by zero");
373 abort();
374 }
375 if (!lhs.is_infinity() && !rhs.is_infinity())
376 {
377 if (lhs._iVal == std::numeric_limits<s64_t>::min() &&
378 rhs._iVal == -1)
379 return plus_infinity();
380 return lhs._iVal / rhs._iVal;
381 }
382 if (!lhs.is_infinity())
383 return 0;
384
385 const bool negative = (lhs._iVal < 0) != (rhs._iVal < 0);
386 return negative ? minus_infinity() : plus_infinity();
387 }

◆ safeMul()

BoundedInt SVF::BoundedInt::safeMul ( const BoundedInt & lhs,
const BoundedInt & rhs )
inlinestatic

Definition at line 338 of file NumericValue.h.

339 {
340 if (lhs.is_zero() || rhs.is_zero())
341 return 0;
342
343 if (lhs.is_infinity() || rhs.is_infinity())
344 {
345 const bool negative = (lhs._iVal < 0) != (rhs._iVal < 0);
346 return negative ? minus_infinity() : plus_infinity();
347 }
348
349 const s64_t min = std::numeric_limits<s64_t>::min();
350 const s64_t max = std::numeric_limits<s64_t>::max();
351 if (lhs._iVal > 0)
352 {
353 if (rhs._iVal > 0 && lhs._iVal > max / rhs._iVal)
354 return plus_infinity();
355 if (rhs._iVal < 0 && rhs._iVal < min / lhs._iVal)
356 return minus_infinity();
357 }
358 else
359 {
360 if (rhs._iVal > 0 && lhs._iVal < min / rhs._iVal)
361 return minus_infinity();
362 if (rhs._iVal < 0 && lhs._iVal < max / rhs._iVal)
363 return plus_infinity();
364 }
365 return lhs._iVal * rhs._iVal;
366 }

◆ safeNeg()

BoundedInt SVF::BoundedInt::safeNeg ( const BoundedInt & value)
inlinestatic

Integer arithmetic policy for finite BoundedInt operands.

Representable results remain exact. Results outside the s64_t range are abstracted to positive or negative infinity. Arithmetic must never rely on signed wraparound or trigger C++ undefined behavior.

Operation Exceptional case Result
-x x == INT64_MIN +inf
a + b result > INT64_MAX +inf
a + b result < INT64_MIN -inf
a - b result > INT64_MAX +inf
a - b result < INT64_MIN -inf
a * b positive overflow +inf
a * b negative overflow -inf
a / b INT64_MIN / -1 +inf
a / b b == 0 invalid
a % b INT64_MIN % -1 0
a % b b == 0 invalid

Operations involving abstract infinities are handled separately by each helper according to the signs of the operands.

Definition at line 283 of file NumericValue.h.

284 {
285 if (value.is_plus_infinity())
286 return minus_infinity();
287 if (value.is_minus_infinity())
288 return plus_infinity();
289 if (value._iVal == std::numeric_limits<s64_t>::min())
290 return plus_infinity();
291 return -value._iVal;
292 }

◆ safeRem()

BoundedInt SVF::BoundedInt::safeRem ( const BoundedInt & lhs,
const BoundedInt & rhs )
inlinestatic

Definition at line 389 of file NumericValue.h.

390 {
391 if (rhs.is_zero())
392 {
393 assert(false && "divide by zero");
394 abort();
395 }
396 if (!lhs.is_infinity() && !rhs.is_infinity())
397 {
398 if (lhs._iVal == std::numeric_limits<s64_t>::min() &&
399 rhs._iVal == -1)
400 return 0;
401 return lhs._iVal % rhs._iVal;
402 }
403 if (!lhs.is_infinity())
404 return 0;
405 if (!rhs.is_infinity())
406 return rhs._iVal > 0 ? lhs : safeNeg(lhs);
407 return lhs.equal(rhs) ? plus_infinity() : minus_infinity();
408 }
static BoundedInt safeNeg(const BoundedInt &value)

◆ safeSub()

BoundedInt SVF::BoundedInt::safeSub ( const BoundedInt & lhs,
const BoundedInt & rhs )
inlinestatic

Definition at line 316 of file NumericValue.h.

317 {
318 if ((lhs.is_plus_infinity() && rhs.is_plus_infinity()) ||
319 (lhs.is_minus_infinity() && rhs.is_minus_infinity()))
320 {
321 assert(false && "invalid subtract");
322 abort();
323 }
324 if (lhs.is_plus_infinity() || rhs.is_minus_infinity())
325 return plus_infinity();
326 if (lhs.is_minus_infinity() || rhs.is_plus_infinity())
327 return minus_infinity();
328
329 const s64_t min = std::numeric_limits<s64_t>::min();
330 const s64_t max = std::numeric_limits<s64_t>::max();
331 if (rhs._iVal < 0 && lhs._iVal > max + rhs._iVal)
332 return plus_infinity();
333 if (rhs._iVal > 0 && lhs._iVal < min + rhs._iVal)
334 return minus_infinity();
335 return lhs._iVal - rhs._iVal;
336 }

◆ set_minus_infinity()

void SVF::BoundedInt::set_minus_infinity ( )
inline

Definition at line 128 of file NumericValue.h.

129 {
130 *this = minus_infinity();
131 }

◆ set_plus_infinity()

void SVF::BoundedInt::set_plus_infinity ( )
inline

Definition at line 122 of file NumericValue.h.

123 {
124 *this = plus_infinity();
125 }

◆ to_string()

virtual const std::string SVF::BoundedInt::to_string ( ) const
inlinevirtual

Definition at line 662 of file NumericValue.h.

663 {
664 if (is_minus_infinity())
665 {
666 return "-oo";
667 }
668 if (is_plus_infinity())
669 {
670 return "+oo";
671 }
672 else
673 return std::to_string(_iVal);
674 }

◆ abs

BoundedInt abs ( const BoundedInt & lhs)
friend

Definition at line 617 of file NumericValue.h.

618 {
619 return lhs.leq(0) ? -lhs : lhs;
620 }

◆ eq

bool eq ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 541 of file NumericValue.h.

542 {
543 return lhs._iVal == rhs._iVal && lhs._isInf == rhs._isInf;
544 }

◆ ite

BoundedInt ite ( const BoundedInt & cond,
const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 523 of file NumericValue.h.

525 {
526 return cond._iVal != 0 ? lhs : rhs;
527 }

◆ max

BoundedInt max ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 565 of file NumericValue.h.

566 {
567 if (lhs.is_plus_infinity() || rhs.is_plus_infinity())
568 return plus_infinity();
569 else if(lhs.is_minus_infinity())
570 return rhs;
571 else if(rhs.is_minus_infinity())
572 return lhs;
573 else
574 return BoundedInt(std::max(lhs._iVal, rhs._iVal));
575 }

◆ min

BoundedInt min ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 549 of file NumericValue.h.

550 {
551 if (lhs.is_minus_infinity() || rhs.is_minus_infinity())
552 return minus_infinity();
553 else if(lhs.is_plus_infinity())
554 return rhs;
555 else if(rhs.is_plus_infinity())
556 return lhs;
557 else
558 return BoundedInt(std::min(lhs._iVal, rhs._iVal));
559 }

◆ operator!

BoundedInt operator! ( const BoundedInt & lhs)
friend

Definition at line 479 of file NumericValue.h.

480 {
481 return !lhs._iVal;
482 }

◆ operator!=

bool operator!= ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 228 of file NumericValue.h.

229 {
230 return !lhs.equal(rhs);
231 }

◆ operator%

BoundedInt operator% ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 435 of file NumericValue.h.

436 {
437 return safeRem(lhs, rhs);
438 }
static BoundedInt safeRem(const BoundedInt &lhs, const BoundedInt &rhs)

◆ operator&

BoundedInt operator& ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 451 of file NumericValue.h.

452 {
453 return lhs._iVal & rhs._iVal;
454 }

◆ operator&&

BoundedInt operator&& ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 467 of file NumericValue.h.

468 {
469 return lhs._iVal && rhs._iVal;
470 }

◆ operator*

BoundedInt operator* ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 425 of file NumericValue.h.

426 {
427 return safeMul(lhs, rhs);
428 }
static BoundedInt safeMul(const BoundedInt &lhs, const BoundedInt &rhs)

◆ operator+

BoundedInt operator+ ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 415 of file NumericValue.h.

416 {
417 return safeAdd(lhs, rhs);
418 }
static BoundedInt safeAdd(const BoundedInt &lhs, const BoundedInt &rhs)

◆ operator- [1/2]

BoundedInt operator- ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 420 of file NumericValue.h.

421 {
422 return safeSub(lhs, rhs);
423 }
static BoundedInt safeSub(const BoundedInt &lhs, const BoundedInt &rhs)

◆ operator- [2/2]

BoundedInt operator- ( const BoundedInt & value)
friend

Definition at line 410 of file NumericValue.h.

411 {
412 return safeNeg(value);
413 }

◆ operator/

BoundedInt operator/ ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 430 of file NumericValue.h.

431 {
432 return safeDiv(lhs, rhs);
433 }
static BoundedInt safeDiv(const BoundedInt &lhs, const BoundedInt &rhs)

◆ operator<

bool operator< ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 240 of file NumericValue.h.

241 {
242 return !lhs.geq(rhs);
243 }

◆ operator<< [1/2]

BoundedInt operator<< ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 507 of file NumericValue.h.

508 {
509 assert(rhs.geq(0) && "rhs should be greater or equal than 0");
510 if (lhs.is_zero())
511 return lhs;
512 else if (lhs.is_infinity())
513 return lhs;
514 else if (rhs.is_infinity())
515 return lhs.geq(0) ? plus_infinity() : minus_infinity();
516 else
517 return lhs._iVal << rhs._iVal;
518 }

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream & out,
const BoundedInt & expr )
friend

Definition at line 532 of file NumericValue.h.

533 {
534 out << expr._iVal;
535 return out;
536 }

◆ operator<=

bool operator<= ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 247 of file NumericValue.h.

248 {
249 return lhs.leq(rhs);
250 }

◆ operator==

bool operator== ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Reload operator.

Definition at line 222 of file NumericValue.h.

223 {
224 return lhs.equal(rhs);
225 }

◆ operator>

bool operator> ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 234 of file NumericValue.h.

235 {
236 return !lhs.leq(rhs);
237 }

◆ operator>=

bool operator>= ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 254 of file NumericValue.h.

255 {
256 return lhs.geq(rhs);
257 }

◆ operator>>

BoundedInt operator>> ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 489 of file NumericValue.h.

490 {
491 assert(rhs.geq(0) && "rhs should be greater or equal than 0");
492 if (lhs.is_zero())
493 return lhs;
494 else if (lhs.is_infinity())
495 return lhs;
496 else if (rhs.is_infinity())
497 return lhs.geq(0) ? 0 : -1;
498 else
499 return lhs._iVal >> rhs._iVal;
500 }

◆ operator^

BoundedInt operator^ ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 445 of file NumericValue.h.

446 {
447 return lhs._iVal ^ rhs._iVal;
448 }

◆ operator|

BoundedInt operator| ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 457 of file NumericValue.h.

458 {
459 return lhs._iVal | rhs._iVal;
460 }

◆ operator||

BoundedInt operator|| ( const BoundedInt & lhs,
const BoundedInt & rhs )
friend

Definition at line 473 of file NumericValue.h.

474 {
475 return lhs._iVal || rhs._iVal;
476 }

Member Data Documentation

◆ _isInf

bool SVF::BoundedInt::_isInf
protected

Definition at line 61 of file NumericValue.h.

◆ _iVal

s64_t SVF::BoundedInt::_iVal
protected

Definition at line 60 of file NumericValue.h.


The documentation for this class was generated from the following file: