tiny_int
object.
More...
#include <tiny_int.h>
Public Member Functions | |
tiny_int () | |
Default constructor. | |
tiny_int (short int v) | |
Create object from any integral type that can be converted to a short int . | |
operator short int () const | |
Return value as a short int . | |
tiny_int & | operator= (short int v) |
Assign a short int to the object. | |
tiny_int & | operator+= (short int v) |
Add another value to this object. | |
tiny_int & | operator-= (short int v) |
Subtract another value to this object. | |
tiny_int & | operator *= (short int v) |
Multiply this value by another object. | |
tiny_int & | operator/= (short int v) |
Divide this value by another object. | |
tiny_int & | operator%= (short int v) |
Divide this value by another object and store the remainder. | |
tiny_int & | operator &= (short int v) |
Bitwise AND this value by another value. | |
tiny_int & | operator|= (short int v) |
Bitwise OR this value by another value. | |
tiny_int & | operator^= (short int v) |
Bitwise XOR this value by another value. | |
tiny_int & | operator<<= (short int v) |
Shift this value left by v positions. | |
tiny_int & | operator>>= (short int v) |
Shift this value right by v positions. | |
tiny_int & | operator++ () |
Add one to this value and return that value. | |
tiny_int & | operator-- () |
Subtract one from this value and return that value. | |
tiny_int | operator++ (int) |
Add one to this value and return the previous value. | |
tiny_int | operator-- (int) |
Subtract one from this value and return the previous value. | |
tiny_int | operator- (const tiny_int &i) const |
Return this value minus i . | |
tiny_int | operator+ (const tiny_int &i) const |
Return this value plus i . | |
tiny_int | operator * (const tiny_int &i) const |
Return this value multiplied by i . | |
tiny_int | operator/ (const tiny_int &i) const |
Return this value divided by i . | |
tiny_int | operator% (const tiny_int &i) const |
Return the modulus of this value divided by i . | |
tiny_int | operator| (const tiny_int &i) const |
Return this value bitwise OR'd by i . | |
tiny_int | operator & (const tiny_int &i) const |
Return this value bitwise AND'd by i . | |
tiny_int | operator^ (const tiny_int &i) const |
Return this value bitwise XOR'd by i . | |
tiny_int | operator<< (const tiny_int &i) const |
Return this value bitwise shifted left by i . | |
tiny_int | operator>> (const tiny_int &i) const |
Return this value bitwise shifted right by i . |
tiny_int
object.
This is required because the closest C++ type, char
, doesn't have all the right semantics. For one, inserting a char
into a stream won't give you a number.
Several of the functions below accept a short
int
argument, but internally we store the data as a char
. Beware of integer overflows!
|
Default constructor. Value is uninitialized |