coan
6.0.1
A C/C++ Configuration Analyzer
|
Class integer
encapsulates an integer of some type.
More...
#include <integer.h>
Public Member Functions | |
integer (integer_type type=INT_INT, unsigned long long val=0) | |
integer_type | type () const |
Get the type of the integer | |
bool | good () const |
Say whether the integer is of valid type, not INT_UNDEF | |
size_t | size () const |
Get the size of the integer | |
bool | is_signed () const |
Say whether the integer is of signed type. | |
unsigned long long | raw () const |
Get the bits comprising the integer as an unsigned long long | |
char const * | type_desc () const |
Get the text descriptor of this integer's type. | |
int | sign () const |
integer | operator< (integer const &rhs) const |
integer | operator<= (integer const &rhs) const |
integer | operator> (integer const &rhs) const |
integer | operator>= (integer const &rhs) const |
integer | operator== (integer const &rhs) const |
integer | operator!= (integer const &rhs) const |
integer | operator&& (integer const &rhs) const |
integer | operator|| (integer const &rhs) const |
integer | operator& (integer const &rhs) const |
integer | operator| (integer const &rhs) const |
integer | operator^ (integer const &rhs) const |
integer | operator! () const |
integer | operator~ () const |
integer | operator- () const |
integer | operator+ () const |
integer | operator+ (integer const &rhs) const |
integer | operator- (integer const &rhs) const |
integer | operator* (integer const &rhs) const |
integer | operator/ (integer const &rhs) const |
integer | operator% (integer const &rhs) const |
integer | operator<< (integer const &rhs) const |
integer | operator>> (integer const &rhs) const |
Private Member Functions | |
unsigned | rank () const |
Get the conversion rank of an integer | |
void | make_unsigned () |
Make the integer unsigned. | |
void | make_signed () |
Make the integer signed. | |
Static Private Member Functions | |
static integer_type | to_unsigned (integer_type type) |
static integer_type | to_signed (integer_type type) |
static unsigned | rank_of (integer_type type) |
static integer_type | result_type (integer const &lhs, integer const &rhs) |
static bool | valid_shift (int direction, integer const &lhs, integer const &rhs) |
static char const * | type_desc (integer_type it) |
Get textual descriptor of an integral type. | |
Private Attributes | |
unsigned long long | _val |
The value of the integer | |
integer_type | _type |
The type of the integer . | |
Friends | |
struct | integer_constant |
|
inlineexplicit |
|
inline |
integer integer::operator!= | ( | integer const & | rhs | ) | const |
Test whether the integer
is not equal to another.
rhs | The other integer to be compared. |
Definition at line 221 of file integer.cpp.
Mod the integer
by another.
rhs | modulus. |
Definition at line 514 of file integer.cpp.
Bitwise AND the integer
with another.
rhs | The other integer . |
Definition at line 313 of file integer.cpp.
Logically AND the integer
with another.
rhs | The other integer to be conjoined. |
Definition at line 267 of file integer.cpp.
Multiply the integer
by another.
rhs | The multiplier. |
Definition at line 468 of file integer.cpp.
|
inline |
Add the integer
to another
rhs | The other integer to be added. |
Definition at line 422 of file integer.cpp.
integer integer::operator- | ( | ) | const |
Invert the sign of an integer
.
Definition at line 382 of file integer.cpp.
Subtract an integer
from *this
.
rhs | The integer to be subtracted. |
Definition at line 445 of file integer.cpp.
Divide the integer
by another.
rhs | The divisor. |
Definition at line 491 of file integer.cpp.
Test whether the integer
is less than another.
rhs | The other integer to be compared. |
Definition at line 129 of file integer.cpp.
Left-shift integer
by another.
rhs | The shift value. |
Definition at line 537 of file integer.cpp.
Test whether the integer
is less than or equal to another.
rhs | The other integer to be compared. |
Definition at line 152 of file integer.cpp.
Test whether the integer
is equal to another.
rhs | The other integer to be compared. |
Definition at line 244 of file integer.cpp.
Test whether the integer
is greater than another.
rhs | The other integer to be compared. |
Definition at line 175 of file integer.cpp.
Test whether the integer
is greater than or equal to another.
rhs | The other integer to be compared. |
Definition at line 198 of file integer.cpp.
Right-shift the integer
by another.
rhs | The shift-value. |
Definition at line 563 of file integer.cpp.
Bitwise XOR the integer
with another.
rhs | The other integer . |
Definition at line 359 of file integer.cpp.
Bitwise OR the integer
with another.
rhs | The other integer . |
Definition at line 336 of file integer.cpp.
Logically OR the integer
with another.
rhs | The other integer to be disjoined. |
Definition at line 290 of file integer.cpp.
integer integer::operator~ | ( | ) | const |
Bitwise negate an integer
.
Definition at line 402 of file integer.cpp.
|
inlinestaticprivate |
|
staticprivate |
Get the integer
_type that results when the the usual arithmetic conversions are applied to on a pair of integer
arithmetic operands.
lhs | The lefthand operand |
rhs | The righthand operand |
INT_UNDEF
the returned type is INT_UNDEF
. Otherwise it is the maximum of lhs.type()
and rhs.type()
. The constants of enum integer_type
are so defined as to make this the correct result.The function emits a warning if the usual arithmetic conversions result in a change of sign on either operand.
Definition at line 69 of file integer.cpp.
int integer::sign | ( | ) | const |
Return the sign of an integer's value.
Definition at line 48 of file integer.cpp.
|
inlinestaticprivate |
|
inlinestaticprivate |
Check the validity of a shift operation. A shift has undefined behaviour if the promoted righthand operand is negative or is >= the width in bits of the lefthand operand.
direction | If < 0, a left shift is indicated, else a right-shift. |
lhs | The lefthand operand. |
rhs | The righthand operand. |
Definition at line 105 of file integer.cpp.