[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This module is defined by the file `polka_num.h', included from `polka.h'. It defines generic operations on integers. The naming scheme and the semantics of these operations comes from the GMP library. They assume in particular that all integer objects are initialized before being used.
typedef struct pkint_t { ACTUALTYPE rep; } pkint_t; |
configure
command.
pkint_t
variables when you are done with them.
signed long int
return the value
of integer. Otherwise return the least significant part of
integer, with the same sign as integer.
If integer is too large to fit in a signed long int
, the returned
result is probably not very useful. To find out if the value will fit, use
the function pkint_fits_slong_p
.
This function is useful in order to allocate the right amount of space
before converting OP to a string. The right amount of allocation is
normally two more than the value returned by pkint_sizeinbase10
.
If str is NULL
, the result string is allocated using
malloc
. The block will be strlen(str)+1
bytes, that being
exactly enough for the string and null-terminator.
If str is not NULL
, it should point to a block of storage
large enough for the result, that being
pkint_sizeinbase10(integer) + 2
. The two extra bytes are
for a possible minus sign, and the null-terminator.
A pointer to the result string is returned, being either the allocated block, or the given str.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |