signed integer value (siv) with status informations and safe operations More...
#include <siv.h>
Public Member Functions | |
| virtual __int64 | stringToValue (const char *stringValue) |
| converts stringValue to a number of type numType | |
| siv (const __int64 val) | |
| constructor (value = val) | |
| siv (const siv &val) | |
| copy constructor (value = val.value; status = val.stat) | |
| void | printBitpat (FILE *file=0) const |
| prints the bitpattern of the signed integer value in hex format | |
| siv & | assignCopy (const double val) |
| rounds a 64-bit floating point value into a 64-bit integer | |
| siv & | assignCopy (const char *strVal) |
| converts and assigns a numerical decimal string to this siv | |
| siv & | operator= (const double val) |
| assign operator to copy a 64-bit floating point value | |
| siv | operator+ (const __int64 addend) const |
| returns this->value + addend in a siv object | |
| siv | operator+ (const siv &addend) const |
| returns this->value + addend in a siv object | |
| siv | operator- (const __int64 &subtrahend) const |
| returns this->value - subtrahend in a siv object | |
| siv | operator- (const siv &subtrahend) const |
| returns this->value - subtrahend in a siv object | |
| siv | operator* (const __int64 multiplicand) const |
| returns this->value * multiplicand in a siv object | |
| siv | operator* (const siv &multiplicand) const |
| returns this->value * multiplicand in a siv object | |
| siv & | assignReciproc () |
| calculates this->value = 1 / this->value | |
| siv | reciproc () const |
| returns the reciproc value (1 / this->value) in a siv object | |
| siv | operator/ (const __int64 denominator) const |
| returns this->value / denominator in a siv object | |
| siv | operator/ (const siv &denominator) const |
| returns this->value / denominator in a siv object | |
| siv | operator% (const __int64 denominator) const |
| returns the remainder of this->value / denominator in a siv object | |
| siv | operator% (const siv &denominator) const |
| returns the remainder of this->value / denominator in a siv object | |
| siv | positive () const |
| returns the absolute value of this->value in a siv object | |
| siv | negative () const |
| returns a negative absolute value of this->value in a siv object | |
| siv | absMin (const siv &val) const |
| returns the orig. value with minimum of both absolute values in a siv object | |
| siv | invertSign () const |
| changes the sign of this value and stores the result in a new siv-object | |
| siv | pow (const int exp) |
| calculates this->value = this->value pow exp | |
| siv | sqrt () const |
| returns sqrt this->value in a siv object | |
| siv & | assignAnd (const __int64 val) |
| this->value &= val (bitwise AND) | |
| siv & | operator&= (const __int64 val) |
| this->value &= val (bitwise AND) | |
| siv | and (const __int64 val) const |
| result = this->value & val (bitwise AND) | |
| siv | operator& (const __int64 val) const |
| returns this->value & val in a siv-object ( value & exp ) | |
| siv & | assignOr (const __int64 val) |
| this->value |= val (bitwise OR) | |
| siv & | operator|= (const __int64 val) |
| this->value |= val (bitwise OR) | |
| siv | or (const __int64 val) const |
| result = this->value | val (bitwise OR) | |
| siv | operator| (const __int64 val) const |
| returns this->value | val in a siv-object (bitwise OR) | |
| siv & | assignBitwiseNot () |
| this->value = ~this->value (bitwise NOT) | |
| siv | bitwiseNot () |
| result = ~this->value (bitwise NOT) | |
| siv & | operator~ () |
| result = ~this->value (bitwise NOT) | |
| siv & | assignXor (const __int64 val) |
| this->value ^= val (bitwise exclusive OR) | |
| siv & | operator^= (const __int64 val) |
| this->value ^= val (bitwise exclusive OR) | |
| siv | xor (const __int64 val) const |
| result = this->value ^ val (bitwise exclusive OR) | |
| siv | operator^ (const __int64 val) const |
| returns this->value ^ val in a siv-object (bitwise exclusive OR) | |
| siv & | assignShiftLeft (const int cnt) |
| this->value <<= cnt (bitwise shift left, insert 0) | |
| siv & | operator<<= (const int cnt) |
| this->value <<= cnt (bitwise shift left and reasign) | |
| siv | shiftLeft (const int cnt) const |
| result = this->value << cnt (bitwise shift left) | |
| siv | operator<< (const int cnt) |
| result = this->value << cnt (bitwise shift left) | |
| siv & | assignShiftRight (const int cnt) |
| this->value >>= cnt (bitwise shift right, insert 0) | |
| siv & | operator>>= (const int cnt) |
| this->value >>= cnt (bitwise shift right and reasign) | |
| siv | shiftRight (const int cnt) const |
| result = this->value >> cnt (bitwise shift right) | |
| siv | operator>> (const int cnt) |
| result = this->value >> cnt (bitwise shift left) | |
| siv & | assignRotLeft (const int cnt) |
| this->value = this->rotLeft( cnt ) (bitwise rotate left) | |
| siv | rotLeft (const int cnt) const |
| result = this->value rotLeft cnt (bitwise rotate left) | |
| siv & | assignRotRight (const int cnt) |
| this->value rotRight cnt (bitwise rotate right) | |
| siv | rotRight (const int cnt) const |
| result = this->value rotRight cnt (bitwise rotate right) | |
signed integer value (siv) with status informations and safe operations
This siv class provides a 64 bit signed value in integer format and safe functions and operations on these values.
The safe functions and operations prevent exceptions like divide by zero. This allows hardware and operating system independend software development.
The status of a siv acts accumulative. This allows straight forward programming of huge mathematical operations and checking the status only at the end of all calculations.
| siv::siv | ( | const __int64 | val | ) | [inline] |
constructor (value = val)
constructs a siv object with value = val
| val | the signed integer value |
| siv::siv | ( | const siv & | val | ) | [inline] |
copy constructor (value = val.value; status = val.stat)
constructs a copy of the siv object val
| val | the signed integer value to be copied. |
returns the orig. value with minimum of both absolute values in a siv object
if ( abs( this->value ) <= abs( val ) )
return *this
else return val
| val | the value to be compared with |
| siv siv::and | ( | const __int64 | val | ) | const [inline] |
result = this->value & val (bitwise AND)
| val | the bit-mask |
| siv& siv::assignAnd | ( | const __int64 | val | ) | [inline] |
this->value &= val (bitwise AND)
| val | the bit-mask |
| siv& siv::assignBitwiseNot | ( | ) | [inline] |
this->value = ~this->value (bitwise NOT)
| siv& siv::assignCopy | ( | const char * | strVal | ) | [inline] |
converts and assigns a numerical decimal string to this siv
| strVal | pointer to the first character in the string where the value begins |
| siv& siv::assignCopy | ( | const double | val | ) | [inline] |
rounds a 64-bit floating point value into a 64-bit integer
| val | the 64-bit float value to be copied into this siv object |
| siv& siv::assignOr | ( | const __int64 | val | ) | [inline] |
this->value |= val (bitwise OR)
| val | the bit-mask |
| siv& siv::assignReciproc | ( | ) | [inline] |
calculates this->value = 1 / this->value
calculates the reciproc value of this->value
| siv& siv::assignRotLeft | ( | const int | cnt | ) | [inline] |
this->value = this->rotLeft( cnt ) (bitwise rotate left)
| cnt | number of bits to be rotated example: 1001 rotLeft 2 (result = 0110) |
| siv& siv::assignRotRight | ( | const int | cnt | ) | [inline] |
this->value rotRight cnt (bitwise rotate right)
| cnt | number of bits to be rotated example: 0001 rotRight 2 (result = 0100) |
| siv& siv::assignShiftLeft | ( | const int | cnt | ) | [inline] |
this->value <<= cnt (bitwise shift left, insert 0)
| cnt | number of bits to be shift example: 0001 << 2 (result = 0100) |
| siv& siv::assignShiftRight | ( | const int | cnt | ) | [inline] |
this->value >>= cnt (bitwise shift right, insert 0)
| cnt | number of bits to be shift example: 1000 >> 2 (result = 0010) |
| siv& siv::assignXor | ( | const __int64 | val | ) | [inline] |
this->value ^= val (bitwise exclusive OR)
example: 1001 ^ 0011 = 1010 (same bits are getting 0, different bits becomes 1)
| siv siv::bitwiseNot | ( | ) | [inline] |
result = ~this->value (bitwise NOT)
| siv siv::invertSign | ( | ) | const [inline] |
changes the sign of this value and stores the result in a new siv-object
returns -( this->value )
| siv siv::negative | ( | ) | const [inline] |
returns a negative absolute value of this->value in a siv object
siv-object = -abs( this->value )
returns the remainder of this->value / denominator in a siv object
| denominator | the value to be divided from this->value to calculate the remainder |
| siv siv::operator% | ( | const __int64 | denominator | ) | const [inline] |
returns the remainder of this->value / denominator in a siv object
| denominator | the value to be divided from this->value to calculate the remainder |
| siv siv::operator& | ( | const __int64 | val | ) | const [inline] |
returns this->value & val in a siv-object ( value & exp )
| val | the bit-mask |
| siv& siv::operator&= | ( | const __int64 | val | ) | [inline] |
this->value &= val (bitwise AND)
| val | the bit-mask |
returns this->value * multiplicand in a siv object
| multiplicand | the value to be multiplied with this->value |
| siv siv::operator* | ( | const __int64 | multiplicand | ) | const [inline] |
returns this->value * multiplicand in a siv object
| multiplicand | the value to be multiplied with this->value |
returns this->value + addend in a siv object
| addend | the value to be added to this->value |
| siv siv::operator+ | ( | const __int64 | addend | ) | const [inline] |
returns this->value + addend in a siv object
| addend | the value to be added to this->value |
returns this->value - subtrahend in a siv object
| subtrahend | the value to be subtracted from this->value |
| siv siv::operator- | ( | const __int64 & | subtrahend | ) | const [inline] |
returns this->value - subtrahend in a siv object
| subtrahend | the value to be subtracted from this->value |
returns this->value / denominator in a siv object
| denominator | the value to be divided from this->value |
| siv siv::operator/ | ( | const __int64 | denominator | ) | const [inline] |
returns this->value / denominator in a siv object
| denominator | the value to be divided from this->value |
| siv siv::operator<< | ( | const int | cnt | ) | [inline] |
result = this->value << cnt (bitwise shift left)
| cnt | number of bits to be shift example: 0001 << 2 (result = 0100) |
| siv& siv::operator<<= | ( | const int | cnt | ) | [inline] |
this->value <<= cnt (bitwise shift left and reasign)
| cnt | number of bits to be shift example: 0001 << 2 (result = 0100) |
| siv& siv::operator= | ( | const double | val | ) | [inline] |
assign operator to copy a 64-bit floating point value
| val | the 64-bit float value to be copied into this siv object |
| siv siv::operator>> | ( | const int | cnt | ) | [inline] |
result = this->value >> cnt (bitwise shift left)
| cnt | number of bits to be shift example: 1000 >> 2 (result = 0010) |
| siv& siv::operator>>= | ( | const int | cnt | ) | [inline] |
this->value >>= cnt (bitwise shift right and reasign)
| cnt | number of bits to be shift example: 1000 >> 2 (result = 0010) |
| siv siv::operator^ | ( | const __int64 | val | ) | const [inline] |
returns this->value ^ val in a siv-object (bitwise exclusive OR)
| val | the bit-mask |
| siv& siv::operator^= | ( | const __int64 | val | ) | [inline] |
this->value ^= val (bitwise exclusive OR)
| val | the bit-mask |
| siv siv::operator| | ( | const __int64 | val | ) | const [inline] |
returns this->value | val in a siv-object (bitwise OR)
| val | the bit-mask |
| siv& siv::operator|= | ( | const __int64 | val | ) | [inline] |
this->value |= val (bitwise OR)
| val | the bit-mask |
| siv& siv::operator~ | ( | ) | [inline] |
result = ~this->value (bitwise NOT)
| siv siv::or | ( | const __int64 | val | ) | const [inline] |
result = this->value | val (bitwise OR)
| val | the bit-mask |
| siv siv::positive | ( | ) | const [inline] |
returns the absolute value of this->value in a siv object
siv-object = abs( this->value )
| siv siv::pow | ( | const int | exp | ) | [inline] |
| void siv::printBitpat | ( | FILE * | file = 0 |
) | const [inline] |
prints the bitpattern of the signed integer value in hex format
| file | pointer to a open FILE with write access. If file=0 (default) this function prints to stdout. If file is a valid pointer this function prints to file. |
| siv siv::reciproc | ( | ) | const [inline] |
returns the reciproc value (1 / this->value) in a siv object
calculates the reciproc value of this->value
| siv siv::rotLeft | ( | const int | cnt | ) | const [inline] |
result = this->value rotLeft cnt (bitwise rotate left)
| cnt | number of bits to be rotated example: 1001 rotLeft 2 (result = 0110) |
| siv siv::rotRight | ( | const int | cnt | ) | const [inline] |
result = this->value rotRight cnt (bitwise rotate right)
| cnt | number of bits to be rotated example: 0001 >> 2 (result = 0100) |
| siv siv::shiftLeft | ( | const int | cnt | ) | const [inline] |
result = this->value << cnt (bitwise shift left)
| cnt | number of bits to be shift example: 0001 << 2 (result = 0100) |
| siv siv::shiftRight | ( | const int | cnt | ) | const [inline] |
result = this->value >> cnt (bitwise shift right)
| cnt | number of bits to be shift example: 1000 >> 2 (result = 0010) |
| siv siv::sqrt | ( | ) | const [inline] |
returns sqrt this->value in a siv object
| virtual __int64 siv::stringToValue | ( | const char * | stringValue | ) | [inline, virtual] |
converts stringValue to a number of type numType
| stringValue | pointer to the first character in the string where the value begins |
| siv siv::xor | ( | const __int64 | val | ) | const [inline] |
result = this->value ^ val (bitwise exclusive OR)
| val | the bit-mask |
1.6.3