"L. Spiro Engine"
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes

lsstd::C128BitInteger Class Reference

A 128-bit integer class. More...

#include <LSSTD128BitInteger.h>

List of all members.

Public Member Functions

LSE_CALLCTOR C128BitInteger (const C128BitInteger &_biOp)
LSE_CALLCTOR C128BitInteger (LSINT64 _i64Src)
LSE_CALLCTOR C128BitInteger (LSUINT64 _ui64Src)
LSE_CALLCTOR C128BitInteger (const LSUINT32 *_pui32Src)
C128BitInteger LSE_CALL operator- () const
C128BitInteger LSE_CALL operator+ (const C128BitInteger &_biOp) const
C128BitInteger LSE_CALL operator* (const C128BitInteger &_biOp) const
C128BitInteger LSE_CALL operator*= (const C128BitInteger &_biOp)
C128BitInteger LSE_CALL operator/ (const C128BitInteger &_biOp) const
C128BitInteger LSE_CALL operator/= (const C128BitInteger &_biOp)
C128BitInteger LSE_CALL operator% (const C128BitInteger &_biOp) const
C128BitInteger LSE_CALL operator- (const C128BitInteger &_biOp) const
C128BitInteger LSE_CALL operator<< (LSUINT32 _ui32Shift) const
C128BitInteger &LSE_CALL operator<<= (LSUINT32 _ui32Shift)
C128BitInteger LSE_CALL operator>> (LSUINT32 _ui32Shift) const
C128BitInteger &LSE_CALL operator>>= (LSUINT32 _ui32Shift)
bool LSE_CALL operator> (const C128BitInteger &_biOp) const
bool LSE_CALL operator< (const C128BitInteger &_biOp) const

Static Public Member Functions

static LSVOID LSE_CALL Negate (const C128BitInteger &_biValue, C128BitInteger &_biResult)
static LSUINT32 LSE_CALL ShiftLeft (LSUINT32 *_pui32Data, LSUINT32 _ui32Len, LSUINT32 _ui32Amount)
static LSUINT32 LSE_CALL ShiftRight (LSUINT32 *_pui32Data, LSUINT32 _ui32Len, LSUINT32 _ui32Amount)
static LSVOID LSE_CALL Add (const C128BitInteger &_biLeft, const C128BitInteger &_biRight, C128BitInteger &_biResult)
static LSVOID LSE_CALL Subtract (const C128BitInteger &_biLeft, const C128BitInteger &_biRight, C128BitInteger &_biResult)
static LSVOID LSE_CALL Multiply (const C128BitInteger &_biLeft, const C128BitInteger &_biRight, C128BitInteger &_biResult)
static LSVOID LSE_CALL Divide (const C128BitInteger &_biLeft, const C128BitInteger &_biRight, C128BitInteger &_biResult)
static LSVOID LSE_CALL Modulus (const C128BitInteger &_biLeft, const C128BitInteger &_biRight, C128BitInteger &_biResult)

Static Protected Member Functions

static LSVOID LSE_CALL DivideM (const C128BitInteger &_biLeft, const C128BitInteger &_biRight, C128BitInteger &_biQuotient, C128BitInteger &_biRemainder)
static LSVOID LSE_CALL DivideS (const C128BitInteger &_biLeft, const C128BitInteger &_biRight, C128BitInteger &_biQuotient, C128BitInteger &_biRemainder)

Protected Attributes

LSUINT32 m_ui32Digits [4]

Detailed Description

A 128-bit integer class.

Class C128BitInteger Description: A 128-bit integer class. This is a high-performance 128-bit signed integer class. Use this when you do not need larger values than 128 bits can hold and require performance.


Member Function Documentation

static LSVOID LSE_CALL lsstd::C128BitInteger::Add ( const C128BitInteger _biLeft,
const C128BitInteger _biRight,
C128BitInteger _biResult 
) [inline, static]

Add two 128-bit integers together and store the result in a third. An exception is thrown on overflow.

Parameters:
_biLeftLeft operand.
_biRightRight operand.
_biResultResult.
static LSVOID LSE_CALL lsstd::C128BitInteger::Divide ( const C128BitInteger _biLeft,
const C128BitInteger _biRight,
C128BitInteger _biResult 
) [inline, static]

Divide two 128-bit integers and store the result in a third. An exception is thrown if the right operand is 0.

Parameters:
_biLeftLeft operand.
_biRightRight operand.
_biResultResult.
static LSVOID LSE_CALL lsstd::C128BitInteger::DivideM ( const C128BitInteger _biLeft,
const C128BitInteger _biRight,
C128BitInteger _biQuotient,
C128BitInteger _biRemainder 
) [inline, static, protected]

Divide the left operand by the right, storing the result in _biQuotient and _biRemainder. The right operand must have more than one digit, and must not be 0.

Parameters:
_biLeftLeft operand.
_biRightRight operand.
_biQuotientThe quotiant part of the result.
_biRemainderThe remainder of the result.
static LSVOID LSE_CALL lsstd::C128BitInteger::DivideS ( const C128BitInteger _biLeft,
const C128BitInteger _biRight,
C128BitInteger _biQuotient,
C128BitInteger _biRemainder 
) [inline, static, protected]

Divide the left operand by the right, storing the result in _biQuotient and _biRemainder. The right operand must have one digit, and must not be 0.

Parameters:
_biLeftLeft operand.
_biRightRight operand.
_biQuotientThe quotiant part of the result.
_biRemainderThe remainder of the result.
static LSVOID LSE_CALL lsstd::C128BitInteger::Modulus ( const C128BitInteger _biLeft,
const C128BitInteger _biRight,
C128BitInteger _biResult 
) [inline, static]

Obtain the modulus of two 128-bit integers and store the result in a third. An exception is thrown if the right operand is 0.

Parameters:
_biLeftLeft operand.
_biRightRight operand.
_biResultResult.
static LSVOID LSE_CALL lsstd::C128BitInteger::Multiply ( const C128BitInteger _biLeft,
const C128BitInteger _biRight,
C128BitInteger _biResult 
) [inline, static]

Multiply two 128-bit integers and store the result in a third. An exception is thrown on overflow.

Parameters:
_biLeftLeft operand.
_biRightRight operand.
_biResultResult.
static LSVOID LSE_CALL lsstd::C128BitInteger::Negate ( const C128BitInteger _biValue,
C128BitInteger _biResult 
) [inline, static]

Negate a 128-bit integer.

Parameters:
_biValueThe value to negate.
_biResultResult.
C128BitInteger LSE_CALL lsstd::C128BitInteger::operator% ( const C128BitInteger _biOp) const [inline]

Modulus two large integers to create a third large integer holding the result. An exception is thrown if the right operand is 0.

Parameters:
_biOpThe right operand.
Returns:
Returns the result as a new large integer.
C128BitInteger LSE_CALL lsstd::C128BitInteger::operator* ( const C128BitInteger _biOp) const [inline]

Multiply two large integers to create a third 128-bit integer holding the result.

Parameters:
_biOpThe right operand.
Returns:
Returns the result as a new 128-bit integer.
C128BitInteger LSE_CALL lsstd::C128BitInteger::operator*= ( const C128BitInteger _biOp) [inline]

Multiply this large integer by other, assiging the result to this large integer. An exception is thrown on overflow.

Parameters:
_biOpThe right operand.
Returns:
Returns this large integer, which will be filled with the result.
C128BitInteger LSE_CALL lsstd::C128BitInteger::operator+ ( const C128BitInteger _biOp) const [inline]

Add two 128-bit integers to create a third 128-bit integer holding the result.

Parameters:
_biOpThe right operand.
Returns:
Returns the result as a new 128-bit integer.
C128BitInteger LSE_CALL lsstd::C128BitInteger::operator- ( const C128BitInteger _biOp) const [inline]

Subtract two large integers to create a third 128-bit integer holding the result. An exception is thrown on overflow.

Parameters:
_biOpThe right operand.
Returns:
Returns the result as a new 128-bit integer.
C128BitInteger LSE_CALL lsstd::C128BitInteger::operator- ( ) const [inline]

Perform unary negation on this number. The negated value is returned.

Returns:
Returns the 2's compliment of this number.
C128BitInteger LSE_CALL lsstd::C128BitInteger::operator/ ( const C128BitInteger _biOp) const [inline]

Divide two large integers to create a third large integer holding the result. An exception is thrown if the right operand is 0.

Parameters:
_biOpThe right operand.
Returns:
Returns the result as a new large integer.
C128BitInteger LSE_CALL lsstd::C128BitInteger::operator/= ( const C128BitInteger _biOp) [inline]

Divide this large integer by other, assiging the result to this large integer. An exception is thrown if the right operand is 0.

Parameters:
_biOpThe right operand.
Returns:
Returns this large integer, which will be filled with the result.
bool LSE_CALL lsstd::C128BitInteger::operator< ( const C128BitInteger _biOp) const [inline]

Less-than comparison.

Parameters:
_biOpThe right operand.
Returns:
Returns true if this large integer is less than the given large integer.
C128BitInteger LSE_CALL lsstd::C128BitInteger::operator<< ( LSUINT32  _ui32Shift) const [inline]

Shift bits left by the given amount. The shifted value is returned.

Parameters:
_ui32ShiftThe amount by which to shift.
Returns:
Returns the result as a new large integer.
C128BitInteger& LSE_CALL lsstd::C128BitInteger::operator<<= ( LSUINT32  _ui32Shift) [inline]

Shift bits left by the given amount, storing the result in this instance.

Parameters:
_ui32ShiftThe amount by which to shift.
Returns:
Returns the this instance, which holds the result.
bool LSE_CALL lsstd::C128BitInteger::operator> ( const C128BitInteger _biOp) const [inline]

Greater-than comparison.

Parameters:
_biOpThe right operand.
Returns:
Returns true if this large integer is greater than the given large integer.
C128BitInteger LSE_CALL lsstd::C128BitInteger::operator>> ( LSUINT32  _ui32Shift) const [inline]

Shift bits right by the given amount. The shifted value is returned.

Parameters:
_ui32ShiftThe amount by which to shift.
Returns:
Returns the result as a new large integer.
C128BitInteger& LSE_CALL lsstd::C128BitInteger::operator>>= ( LSUINT32  _ui32Shift) [inline]

Shift bits right by the given amount, storing the result in this instance.

Parameters:
_ui32ShiftThe amount by which to shift.
Returns:
Returns the this instance, which holds the result.
static LSUINT32 LSE_CALL lsstd::C128BitInteger::ShiftLeft ( LSUINT32 *  _pui32Data,
LSUINT32  _ui32Len,
LSUINT32  _ui32Amount 
) [inline, static]

Shift bits left (up).

Parameters:
_pui32DataActs as both the input array of bytes and the output.
_ui32LenLength of the buffer.
_ui32AmountAmount by which to shift.
Returns:
Returns the number of used digits.
static LSUINT32 LSE_CALL lsstd::C128BitInteger::ShiftRight ( LSUINT32 *  _pui32Data,
LSUINT32  _ui32Len,
LSUINT32  _ui32Amount 
) [inline, static]

Shift bits right (down).

Parameters:
_pui32DataActs as both the input array of bytes and the output.
_ui32LenLength of the buffer.
_ui32AmountAmount by which to shift.
Returns:
Returns the number of used digits.
static LSVOID LSE_CALL lsstd::C128BitInteger::Subtract ( const C128BitInteger _biLeft,
const C128BitInteger _biRight,
C128BitInteger _biResult 
) [inline, static]

Subtract two 128-bit integers together and store the result in a third. An exception is thrown on overflow.

Parameters:
_biLeftLeft operand.
_biRightRight operand.
_biResultResult.

Member Data Documentation

LSUINT32 lsstd::C128BitInteger::m_ui32Digits[4] [protected]

The 2 32-bit components that compose this 128-bit integer.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator