Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
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)
 
BoundedIntoperator= (const BoundedInt &rhs)
 
 BoundedInt (BoundedInt &&rhs)
 
BoundedIntoperator= (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 safeAdd (const BoundedInt &lhs, const BoundedInt &rhs)
 
static BoundedInt safeMul (const BoundedInt &lhs, const BoundedInt &rhs)
 Performs safe multiplication of two BoundedInt objects.
 
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 &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 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 0 for negative infinity).

Definition at line 55 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 70 of file NumericValue.h.

70: _iVal(fVal), _isInf(false) {}
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

◆ BoundedInt() [3/5]

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

Definition at line 74 of file NumericValue.h.

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

◆ BoundedInt() [4/5]

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

Definition at line 77 of file NumericValue.h.

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

◆ BoundedInt() [5/5]

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

Definition at line 88 of file NumericValue.h.

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

◆ ~BoundedInt()

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

Definition at line 99 of file NumericValue.h.

99{}

Member Function Documentation

◆ equal()

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

Definition at line 156 of file NumericValue.h.

157 {
158 return _iVal == rhs._iVal && _isInf == rhs._isInf;
159 }

◆ geq()

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

Definition at line 190 of file NumericValue.h.

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

◆ getFVal()

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

Definition at line 718 of file NumericValue.h.

719 {
720 assert(false && "cannot get real number for integer!");
721 abort();
722 }

◆ getIntNumeral()

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

Definition at line 707 of file NumericValue.h.

708 {
709 return getNumeral();
710 }
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 665 of file NumericValue.h.

666 {
667 // If the object represents negative infinity, return the minimum
668 // representable 64-bit integer.
669 if (is_minus_infinity())
670 {
671 return std::numeric_limits<s64_t>::min();
672 }
673 // If the object represents positive infinity, return the maximum
674 // representable 64-bit integer.
675 else if (is_plus_infinity())
676 {
677 return std::numeric_limits<s64_t>::max();
678 }
679 // Otherwise, return the actual 64-bit integer value of the object.
680 else
681 {
682 return _iVal;
683 }
684 }
bool is_minus_infinity() const

◆ getRealNumeral()

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

Definition at line 712 of file NumericValue.h.

713 {
714 assert(false && "cannot get real number for integer!");
715 abort();
716 }

◆ is_infinity()

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

Definition at line 114 of file NumericValue.h.

115 {
117 }

◆ is_minus_infinity()

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

Definition at line 108 of file NumericValue.h.

109 {
110 return _isInf && _iVal == -1;
111 }

◆ is_plus_infinity()

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

Definition at line 102 of file NumericValue.h.

103 {
104 return _isInf && _iVal == 1;
105 }

◆ is_real()

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

Definition at line 702 of file NumericValue.h.

703 {
704 return false;
705 }

◆ is_true()

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

Definition at line 649 of file NumericValue.h.

650 {
651 return _iVal != 0;
652 }

◆ is_zero()

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

Definition at line 144 of file NumericValue.h.

145 {
146 return _iVal == 0;
147 }

◆ isZero()

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

Definition at line 150 of file NumericValue.h.

151 {
152 return expr._iVal == 0;
153 }

◆ leq()

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

Definition at line 162 of file NumericValue.h.

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

◆ max()

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

Definition at line 623 of file NumericValue.h.

624 {
626 for (const auto& it : _l)
627 {
628 if (it.is_plus_infinity())
629 return plus_infinity();
630 else if (!it.leq(ret))
631 {
632 ret = it;
633 }
634 }
635 return ret;
636 }
BoundedInt()=default
static BoundedInt plus_infinity()
static BoundedInt minus_infinity()

◆ min()

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

Definition at line 605 of file NumericValue.h.

606 {
608 for (const auto& it : _l)
609 {
610 if (it.is_minus_infinity())
611 return minus_infinity();
612 else if (!it.geq(ret))
613 {
614 ret = it;
615 }
616 }
617 return ret;
618 }

◆ minus_infinity()

static BoundedInt SVF::BoundedInt::minus_infinity ( )
inlinestatic

Definition at line 138 of file NumericValue.h.

139 {
140 return {-1, true};
141 }

◆ operator=() [1/2]

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

Definition at line 91 of file NumericValue.h.

92 {
93 _iVal = rhs._iVal;
94 _isInf = rhs._isInf;
95 return *this;
96 }

◆ operator=() [2/2]

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

Definition at line 80 of file NumericValue.h.

81 {
82 _iVal = rhs._iVal;
83 _isInf = rhs._isInf;
84 return *this;
85 }

◆ plus_infinity()

static BoundedInt SVF::BoundedInt::plus_infinity ( )
inlinestatic

Definition at line 132 of file NumericValue.h.

133 {
134 return {1, true};
135 }

◆ safeAdd()

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

Safely adds two BoundedInt objects.

This function adds two BoundedInt objects in a way that respects the bounds of the underlying s64_t type. It checks for conditions that would result in overflow or underflow and returns a representation of positive or negative infinity in those cases. If addition of the two numbers would result in a value that is within the representable range of s64_t, it performs the addition and returns the result. If the addition is not defined (e.g., positive infinity plus negative infinity), it asserts false to indicate an error.

Parameters
lhsThe first BoundedInt to add. This can be any valid BoundedInt, including positive and negative infinity.
rhsThe second BoundedInt to add. This can be any valid BoundedInt, including positive and negative infinity.
Returns
A BoundedInt that represents the result of the addition. If the addition would result in overflow, the function returns a BoundedInt representing positive infinity. If the addition would result in underflow, the function returns a BoundedInt representing negative infinity. If the addition is not defined (e.g., positive infinity plus negative infinity), the function asserts false and does not return a value.

Definition at line 281 of file NumericValue.h.

282 {
283 // If one number is positive infinity and the other is negative
284 // infinity, this is an invalid operation, so we assert false.
285 if ((lhs.is_plus_infinity() && rhs.is_minus_infinity()) ||
286 (lhs.is_minus_infinity() && rhs.is_plus_infinity()))
287 {
288 assert(false && "invalid add");
289 }
290
291 // If either number is positive infinity, the result is positive
292 // infinity.
293 if (lhs.is_plus_infinity() || rhs.is_plus_infinity())
294 {
295 return plus_infinity();
296 }
297
298 // If either number is negative infinity, the result is negative
299 // infinity.
300 if (lhs.is_minus_infinity() || rhs.is_minus_infinity())
301 {
302 return minus_infinity();
303 }
304
305 // If both numbers are positive and their sum would exceed the maximum
306 // representable number, the result is positive infinity.
307 if (lhs._iVal > 0 && rhs._iVal > 0 &&
308 (std::numeric_limits<s64_t>::max() - lhs._iVal) < rhs._iVal)
309 {
310 return plus_infinity();
311 }
312
313 // If both numbers are negative and their sum would be less than the
314 // most negative representable number, the result is negative infinity.
315 if (lhs._iVal < 0 && rhs._iVal < 0 &&
316 (-std::numeric_limits<s64_t>::max() - lhs._iVal) > rhs._iVal)
317 {
318 return minus_infinity();
319 }
320
321 // If none of the above conditions are met, the numbers can be safely
322 // added.
323 return lhs._iVal + rhs._iVal;
324 }

◆ safeMul()

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

Performs safe multiplication of two BoundedInt objects.

This function ensures that the multiplication of two BoundedInt objects doesn't result in overflow or underflow. It returns the multiplication result if it can be represented within the range of a 64-bit integer. If the result would be larger than the maximum representable positive number, it returns positive infinity. If the result would be less than the minimum representable negative number, it returns negative infinity. If either of the inputs is zero, the result is zero. If either of the inputs is infinity, the result is determined by the signs of the inputs.

Parameters
lhsThe first BoundedInt to multiply.
rhsThe second BoundedInt to multiply.
Returns
The result of the multiplication, or positive/negative infinity if the result would be outside the range of a 64-bit integer.

Definition at line 365 of file NumericValue.h.

366 {
367 // If either number is zero, the result is zero.
368 if (lhs._iVal == 0 || rhs._iVal == 0)
369 return 0;
370
371 // If either number is infinity, the result depends on the signs of the
372 // numbers.
373 if (lhs.is_infinity() || rhs.is_infinity())
374 {
375 // If the signs of the numbers are the same, the result is positive
376 // infinity. If the signs of the numbers are different, the result
377 // is negative infinity.
378 if (lhs._iVal * rhs._iVal > 0)
379 {
380 return plus_infinity();
381 }
382 else
383 {
384 return minus_infinity();
385 }
386 }
387
388 // If both numbers are positive and their product would exceed the
389 // maximum representable number, the result is positive infinity.
390 if (lhs._iVal > 0 && rhs._iVal > 0 &&
391 (std::numeric_limits<s64_t>::max() / lhs._iVal) < rhs._iVal)
392 {
393 return plus_infinity();
394 }
395
396 // If both numbers are negative and their product would exceed the
397 // maximum representable number, the result is positive infinity.
398 if (lhs._iVal < 0 && rhs._iVal < 0 &&
399 (std::numeric_limits<s64_t>::max() / lhs._iVal) > rhs._iVal)
400 {
401 return plus_infinity();
402 }
403
404 // If one number is positive and the other is negative and their product
405 // would be less than the most negative representable number, the result
406 // is negative infinity.
407 if ((lhs._iVal > 0 && rhs._iVal < 0 &&
408 (-std::numeric_limits<s64_t>::max() / lhs._iVal) > rhs._iVal) ||
409 (lhs._iVal < 0 && rhs._iVal > 0 &&
410 (-std::numeric_limits<s64_t>::max() / rhs._iVal) > lhs._iVal))
411 {
412 return minus_infinity();
413 }
414
415 // If none of the above conditions are met, the numbers can be safely
416 // multiplied.
417 return lhs._iVal * rhs._iVal;
418 }

◆ set_minus_infinity()

void SVF::BoundedInt::set_minus_infinity ( )
inline

Definition at line 126 of file NumericValue.h.

127 {
128 *this = minus_infinity();
129 }

◆ set_plus_infinity()

void SVF::BoundedInt::set_plus_infinity ( )
inline

Definition at line 120 of file NumericValue.h.

121 {
122 *this = plus_infinity();
123 }

◆ to_string()

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

Definition at line 686 of file NumericValue.h.

687 {
688 if (is_minus_infinity())
689 {
690 return "-oo";
691 }
692 if (is_plus_infinity())
693 {
694 return "+oo";
695 }
696 else
697 return std::to_string(_iVal);
698 }

Friends And Related Symbol Documentation

◆ abs

BoundedInt abs ( const BoundedInt lhs)
friend

Definition at line 641 of file NumericValue.h.

642 {
643 return lhs.leq(0) ? -lhs : lhs;
644 }

◆ eq

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

Definition at line 565 of file NumericValue.h.

566 {
567 return lhs._iVal == rhs._iVal && lhs._isInf == rhs._isInf;
568 }

◆ ite

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

Definition at line 547 of file NumericValue.h.

549 {
550 return cond._iVal != 0 ? lhs : rhs;
551 }

◆ max

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

Definition at line 589 of file NumericValue.h.

590 {
591 if (lhs.is_plus_infinity() || rhs.is_plus_infinity())
592 return plus_infinity();
593 else if(lhs.is_minus_infinity())
594 return rhs;
595 else if(rhs.is_minus_infinity())
596 return lhs;
597 else
598 return BoundedInt(std::max(lhs._iVal, rhs._iVal));
599 }

◆ min

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

Definition at line 573 of file NumericValue.h.

574 {
575 if (lhs.is_minus_infinity() || rhs.is_minus_infinity())
576 return minus_infinity();
577 else if(lhs.is_plus_infinity())
578 return rhs;
579 else if(rhs.is_plus_infinity())
580 return lhs;
581 else
582 return BoundedInt(std::min(lhs._iVal, rhs._iVal));
583 }

◆ operator!

BoundedInt operator! ( const BoundedInt lhs)
friend

Definition at line 503 of file NumericValue.h.

504 {
505 return !lhs._iVal;
506 }

◆ operator!=

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

Definition at line 226 of file NumericValue.h.

227 {
228 return !lhs.equal(rhs);
229 }

◆ operator%

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

Definition at line 421 of file NumericValue.h.

422 {
423 if (rhs.is_zero())
424 assert(false && "divide by zero");
425 else if (!lhs.is_infinity() && !rhs.is_infinity())
426 return lhs._iVal % rhs._iVal;
427 else if (!lhs.is_infinity() && rhs.is_infinity())
428 return 0;
429 // TODO: not sure
430 else if (lhs.is_infinity() && !rhs.is_infinity())
431 return ite(rhs._iVal > 0, lhs, -lhs);
432 else
433 // TODO: +oo/-oo L'Hôpital's rule?
434 return eq(lhs, rhs) ? plus_infinity() : minus_infinity();
435 abort();
436 }
friend BoundedInt ite(const BoundedInt &cond, const BoundedInt &lhs, const BoundedInt &rhs)
friend bool eq(const BoundedInt &lhs, const BoundedInt &rhs)

◆ operator&

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

Definition at line 475 of file NumericValue.h.

476 {
477 return lhs._iVal & rhs._iVal;
478 }

◆ operator&&

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

Definition at line 491 of file NumericValue.h.

492 {
493 return lhs._iVal && rhs._iVal;
494 }

◆ operator*

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

Definition at line 439 of file NumericValue.h.

440 {
441 return safeMul(lhs, rhs);
442 }
static BoundedInt safeMul(const BoundedInt &lhs, const BoundedInt &rhs)
Performs safe multiplication of two BoundedInt objects.

◆ operator+

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

Definition at line 328 of file NumericValue.h.

329 {
330 return safeAdd(lhs, rhs);
331 }
static BoundedInt safeAdd(const BoundedInt &lhs, const BoundedInt &rhs)

◆ operator- [1/2]

BoundedInt operator- ( const BoundedInt lhs)
friend

Definition at line 335 of file NumericValue.h.

336 {
337 return {-lhs._iVal, lhs._isInf};
338 }

◆ operator- [2/2]

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

Definition at line 343 of file NumericValue.h.

344 {
345 return safeAdd(lhs, -rhs);
346 }

◆ operator/

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

Definition at line 447 of file NumericValue.h.

448 {
449 if (rhs.is_zero())
450 {
451 assert(false && "divide by zero");
452 abort();
453 }
454 else if (!lhs.is_infinity() && !rhs.is_infinity())
455 return lhs._iVal / rhs._iVal;
456 else if (!lhs.is_infinity() && rhs.is_infinity())
457 return 0;
458 else if (lhs.is_infinity() && !rhs.is_infinity())
459 return ite(rhs._iVal >= 0, lhs, -lhs);
460 else
461 return eq(lhs, rhs) ? plus_infinity() : minus_infinity();
462 }

◆ operator<

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

Definition at line 238 of file NumericValue.h.

239 {
240 return !lhs.geq(rhs);
241 }

◆ operator<< [1/2]

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

Definition at line 531 of file NumericValue.h.

532 {
533 assert(rhs.geq(0) && "rhs should be greater or equal than 0");
534 if (lhs.is_zero())
535 return lhs;
536 else if (lhs.is_infinity())
537 return lhs;
538 else if (rhs.is_infinity())
539 return lhs.geq(0) ? plus_infinity() : minus_infinity();
540 else
541 return lhs._iVal << rhs._iVal;
542 }

◆ operator<< [2/2]

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

Definition at line 556 of file NumericValue.h.

557 {
558 out << expr._iVal;
559 return out;
560 }

◆ operator<=

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

Definition at line 245 of file NumericValue.h.

246 {
247 return lhs.leq(rhs);
248 }

◆ operator==

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

Reload operator.

Definition at line 220 of file NumericValue.h.

221 {
222 return lhs.equal(rhs);
223 }

◆ operator>

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

Definition at line 232 of file NumericValue.h.

233 {
234 return !lhs.leq(rhs);
235 }

◆ operator>=

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

Definition at line 252 of file NumericValue.h.

253 {
254 return lhs.geq(rhs);
255 }

◆ operator>>

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

Definition at line 513 of file NumericValue.h.

514 {
515 assert(rhs.geq(0) && "rhs should be greater or equal than 0");
516 if (lhs.is_zero())
517 return lhs;
518 else if (lhs.is_infinity())
519 return lhs;
520 else if (rhs.is_infinity())
521 return lhs.geq(0) ? 0 : -1;
522 else
523 return lhs._iVal >> rhs._iVal;
524 }

◆ operator^

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

Definition at line 469 of file NumericValue.h.

470 {
471 return lhs._iVal ^ rhs._iVal;
472 }

◆ operator|

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

Definition at line 481 of file NumericValue.h.

482 {
483 return lhs._iVal | rhs._iVal;
484 }

◆ operator||

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

Definition at line 497 of file NumericValue.h.

498 {
499 return lhs._iVal || rhs._iVal;
500 }

Member Data Documentation

◆ _isInf

bool SVF::BoundedInt::_isInf
protected

Definition at line 59 of file NumericValue.h.

◆ _iVal

s64_t SVF::BoundedInt::_iVal
protected

Definition at line 58 of file NumericValue.h.


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