Ruby: pm_integer_t Struct Reference

Ruby 4.0.5p0 (2026-05-20 revision 64336ffd0ee9e1f4c05891695a3d7b49cb709721)

Public Member Functions | Data Fields
pm_integer_t Struct Reference

A structure represents an arbitrary-sized integer. More...

`#include <pm_integer.h>`

## Public Member Functions
PRISM_EXPORTED_FUNCTION void | pm_integer_string (pm_buffer_t *buffer, const pm_integer_t *integer)
| Convert an integer to a decimal string.
PRISM_EXPORTED_FUNCTION void | pm_integer_free (pm_integer_t *integer)
| Free the internal memory of an integer.

## Data Fields
size_t | length
| The number of allocated values.
uint32_t * | values
| List of 32-bit integers.
uint32_t | value
| Embedded value for small integer.
bool | negative
| Whether or not the integer is negative.

## Detailed Description

A structure represents an arbitrary-sized integer.

Definition at line 20 of file pm_integer.h.

## Member Function Documentation

## ◆ pm_integer_free()

PRISM_EXPORTED_FUNCTION void pm_integer_free | ( | pm_integer_t * | integer | ) |

Free the internal memory of an integer.

This memory will only be allocated if the integer exceeds the size of a single node in the linked list.

Parameters

  integer | The integer to free.

Definition at line 666 of file pm_integer.c.

Referenced by pm_integer_free(), and pm_integer_string().

## ◆ pm_integer_string()

PRISM_EXPORTED_FUNCTION void pm_integer_string | ( | pm_buffer_t * | buffer,
|  | const pm_integer_t * | integer )

Convert an integer to a decimal string.

Parameters

  buffer | The buffer to append the string to.
  integer | The integer to convert to a string.

Definition at line 607 of file pm_integer.c.

Referenced by pm_integer_string().

## Field Documentation

## ◆ length

size_t pm_integer_t::length

The number of allocated values.

length is set to 0 if the integer fits into uint32_t.

Definition at line 25 of file pm_integer.h.

Referenced by pm_integer_compare(), pm_integer_string(), and pm_integers_reduce().

## ◆ negative

bool pm_integer_t::negative

Whether or not the integer is negative.

It is stored this way so that a zeroed pm_integer_t is always positive zero.

Definition at line 42 of file pm_integer.h.

Referenced by pm_integer_compare(), and pm_integer_string().

## ◆ value

uint32_t pm_integer_t::value

Embedded value for small integer.

This value is set to 0 if the value does not fit into uint32_t.

Definition at line 36 of file pm_integer.h.

Referenced by pm_integer_compare(), pm_integer_parse(), pm_integer_string(), and pm_integers_reduce().

## ◆ values

uint32_t* pm_integer_t::values

List of 32-bit integers.

Set to NULL if the integer fits into uint32_t.

Definition at line 30 of file pm_integer.h.

Referenced by pm_integer_compare(), pm_integer_free(), and pm_integer_string().

The documentation for this struct was generated from the following file:

- prism/util/pm_integer.h