index previous next 

file name: int128.hpp, int128.cpp
classification: pure simulation
contents: class INT128
derived from: class Integer (GNU Library)
use: provides a class for doing the 91 bit arithmetic needed for simulating the UTCSU

global items used by INT128:

 
member functions of INT128:

INT128 (): initializes the value to zero.

INT128 (INT32 ms, INT32 ts, INT32 us, INT8 ns): Sets the value of the INT128 to the NTPTIME specified in the parameters via a call to SetNtp().

void GetBinary (INT32& a3, INT32& a2, INT32& a1, INT32& a0): The function assumes that a0 is the lowest INT32, a3 the highest, and sets the parameters to the value of the INT128 accordingly.

void GetNtp (INT32& ms, INT32& ts, INT32& us, INT8& ns, INT8& overflow): Reads the value of the INT128 into the ms, ts, us and ns parameters, which are in the UTCSU format. The lowest three bits of the value are put into ns, bit four is the lsb of the us. Only the lowest three bytes of the ms are set (so the value is cut off at NTP bit +32), and if the value is greater, then overflow is set to 1. If the internal number fits into the NTPTIME, then overflow is set to 0.

INT128& operator= (const Integer& i): Assign the Integer value to the INT128 value.

INT128& operator~ (): Inverts the INT128 value. Inversion is done in 16-bit steps. So if the value is 0x1FFFFFFFF, then ~0x1FFFFFFFF = 0xFFFE00000000.

void SetBinary (INT32 a3, INT32 a2, INT32 a1, INT32 a0): The function assumes that a0 is the lowest INT32, a3 the highest, and sets the value of the INT128 accordingly.

void SetNtp (INT32 ms, INT32 ts, INT32 us, INT8 ns): The function assumes that the parameters are in the UTCSU format and sets the value of the INT128 accordingly. This means that only the lowest three bits of the ns are considered valid, and the fourth bit of the internal value is the lsb of us. The function cuts off the ms at NTP bit +32 (that is, it uses only the first three bytes of the ms).


last modified: Fri Feb 5 18:56:22 1999