A wrapper around a contiguous block of allocated memory.
void pm_integers_reduce(pm_integer_t *numerator, pm_integer_t *denominator)
Reduce a ratio of integers to its simplest form.
PRISM_EXPORTED_FUNCTION void pm_integer_free(pm_integer_t *integer)
Free the internal memory of an integer.
int pm_integer_compare(const pm_integer_t *left, const pm_integer_t *right)
Compare two integers.
pm_integer_base_t
An enum controlling the base of an integer.
@ PM_INTEGER_BASE_DEFAULT
The default decimal base, with no prefix.
@ PM_INTEGER_BASE_BINARY
The binary base, indicated by a 0b or 0B prefix.
@ PM_INTEGER_BASE_DECIMAL
The decimal base, indicated by a 0d, 0D, or empty prefix.
@ PM_INTEGER_BASE_HEXADECIMAL
The hexadecimal base, indicated by a 0x or 0X prefix.
@ PM_INTEGER_BASE_OCTAL
The octal base, indicated by a 0, 0o, or 0O prefix.
@ PM_INTEGER_BASE_UNKNOWN
An unknown base, in which case pm_integer_parse will derive it based on the content of the string.
PRISM_EXPORTED_FUNCTION void pm_integer_string(pm_buffer_t *buffer, const pm_integer_t *integer)
Convert an integer to a decimal string.
void pm_integer_parse(pm_integer_t *integer, pm_integer_base_t base, const uint8_t *start, const uint8_t *end)
Parse an integer from a string.
Macro definitions used throughout the prism library.
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
A pm_buffer_t is a simple memory buffer that stores data in a contiguous block of memory.
A structure represents an arbitrary-sized integer.
size_t length
The number of allocated values.
uint32_t value
Embedded value for small integer.
uint32_t * values
List of 32-bit integers.
bool negative
Whether or not the integer is negative.