Infinite Precision Integers (ZINT)


Functions

bool isZINT (SatAddr src)
 is object an infinite precision integer (ZINT)?
bool ZINTdecodell (SatAddr src, long long *dst)
 Convert a ZINT to C long long.
SatAddr ZINTencodell (long long src, SatAddr dst)
 Convert a C long long to an HP ZINT.
char * ZINTdecodeStr (SatAddr src, char *str)
 Convert a ZINT to a NULL-terminated C string of ASCII digits.
SatAddr ZINTencodeStr (const char *src, SatAddr dst)
 Convert a NULL-terminated C string if ASCII digits to an HP ZINT.
SatAddr makeZINT (int digits)
 Make a ZINT in TEMPOB with room for "digits" digits.
int ZINTnibbles (SatAddr src)
 The size of a ZINT in nibbles.
int ZINTdigits (SatAddr src)
 Get the number of digits in a ZINT.
int ZINTbytes (SatAddr src)
 Return the number of bytes needed to store a ZINT as a string.

Function Documentation

bool isZINT ( SatAddr  src  ) 

is object an infinite precision integer (ZINT)?

Parameters:
src Saturn address of an object
Returns:
true if the object at src is a ZINT

int ZINTbytes ( SatAddr  src  ) 

Return the number of bytes needed to store a ZINT as a string.

Parameters:
src The Saturn address of the ZINT
Returns:
The number of bytes needed, or -1 on error

bool ZINTdecodell ( SatAddr  src,
long long *  dst 
)

Convert a ZINT to C long long.

Parameters:
src The ZINT to decode
dst Where to store the ZINT's value
Returns:
true on success, false if src doesn't contain a ZINT or if src won't fit in a long long

char* ZINTdecodeStr ( SatAddr  src,
char *  str 
)

Convert a ZINT to a NULL-terminated C string of ASCII digits.

Parameters:
src The ZINT to decode
dst Where to store the ZINT's value. If set, then dst must contain enough space for the number, which you can get from ZINTbytes(). IF dst is zero, then sufficient space is allocated for the string and the caller must free the space.
Returns:
the decoded string, or zero if src isn't a ZINT or another error occurs.

int ZINTdigits ( SatAddr  src  ) 

Get the number of digits in a ZINT.

Parameters:
src The Saturn address of the ZINT
Returns:
The number of digits in the zint. Note that this returns 1 when the ZINT is zero, even though the ZINT doesn't store any digits for zero.

SatAddr ZINTencodell ( long long  src,
SatAddr  dst 
)

Convert a C long long to an HP ZINT.

Parameters:
src The long long to convert.
dst If non-zero then dst must contain exactly enough room for the ZINT. If zero then a new ZINT is created.
Returns:
The ZINT's Saturn address, or zero on error

SatAddr ZINTencodeStr ( const char *  src,
SatAddr  dst 
)

Convert a NULL-terminated C string if ASCII digits to an HP ZINT.

Parameters:
src The string to convert. For example, "12345"
dst Where to store the ZINT. If non-zero then dst must contain exactly the right amount of space for the resulting ZINT. If zero, then the space will be allocated in TEMPOB.
Returns:
The ZINT's Saturn address, or zero on error

int ZINTnibbles ( SatAddr  src  ) 

The size of a ZINT in nibbles.

Parameters:
src Saturn address of the ZINT.
Returns:
The number of nibbles occupied by the ZINT


Generated on Sat Apr 3 16:38:31 2010 for HPObjects by  doxygen 1.5.0