Next Previous Table of Contents

# LInteger Global Declarations

## `typedef`s

The following global `typedef`s are found in `<lmisc/ltypes.hxx>`:

- `typedef unsigned long long u64;`
- `typedef unsigned long u32;`
- `typedef unsigned short u16;`
- `typedef unsigned char u8;`

## Preprocessor Predicates

### LC_CPU

`<lmisc/config.h>` contains the following assertion:

    #assert LC_CPU (i486)

This assertion should be made when compiling for i486 or better processors. Remove this assertion if you wish to compile libraries which will be usuable by i386 processors.

### LC_OS

`<lmisc/config.h>` contains the following assertion:

    #assert LC_OS (linux)

This assertion should be made when compiling for the Linux operating system. If compiling for the Windows NT operating system, this assertion should be replaced with

    #assert LC_OS (winnt)

It is strongly suspected that the above assertion will allow the libraries to be compiled for Windows '95, but this has not been tested. Compilation on other operating systems will probably requiring hacking. See the installation page for more details.

## Public Functions

### LC_Swap

`<lmisc/lmisc.hxx>` declares the following global function:

    template<class T> inline void LC_Swap(T& a, T& b);

This function swaps a and b so that, after the function is called, a is equal to the value of b before the function was called, and b is equal to the value of a before the function was called. Class `T` needs to have an operator for the assignment from instances of `T` overloaded.

### LC_Min

`<lmisc/lmisc.hxx>` declares the following global function:

    template<class T> inline const T& LC_Min(const T& x, const T& y);

This function returns x if x is less than y and y otherwise. The `<` operator comparing instances of `T` must be overloaded.

### LC_Max

`<lmisc/lmisc.hxx>` declares the following global function:

    template<class T> inline const T& LC_Max(const T& x, const T& y);

This function returns x if x is greater than y and y otherwise. The `>` operator comparing instances of `T` must be overloaded.

### LC_Exp

`<linteger/lexp.hxx>` declares the following global function:

    template<class T> T LC_Exp(const T& g, const LInteger& x);

This function returns a `T` instance representing g raised to the power of the integer that x represents. x must represent a non-negative integer. Additionally, the class `T` must implement the following methods:

- `static const T& T::MultiplicativeIdentity()`
- `T& T::Square()`

Finally, the operator `T& T::operator*=(const T&)` must be overloaded.

## Private Constants

The `<linteger/lexp.phx>` declares the following global constant data which should be regarded as private:

- `extern const int LC_AToT[256];`
- `extern const int LC_AToB[256];`

## Private Functions

`<chnhash/sha1.hxx>` declares the following global function which should be regarded as private:

- `extern "C" {void LC_SHA1_Scramble(u32*,u32*,u32*,u32*,u32*, u32*);}`

Similarly, `<linteger/lexp.phx>` declares the following global functions which should be regarded as private:

- `int LC_LUNibble(unsigned int*, int);`
- `int LC_LUByte(unsigned int*, int);`
- `int LC_FirstNonZeroNibble(const unsigned int);`
- `int LC_FirstNonZeroByte(const unsigned int);`

Finally, `<linteger/lexp.tpl>` declares the following global functions which should be regarded as private:

- `template<class T> T LC_SmallExp(const T&, const LInteger&);`
- `template<class T> T LC_MediumExp(const T&, const LInteger&);`
- `template<class T> T LC_BigExp(const T&, const LInteger&);`

Next Previous Table of Contents