[DOC] Tweaks for String#chomp
[ruby.git] / prism / util / pm_integer.h
bloba9e2966703408be962b2479817817b8afadacc0c
1 /**
2 * @file pm_integer.h
4 * This module provides functions for working with arbitrary-sized integers.
5 */
6 #ifndef PRISM_NUMBER_H
7 #define PRISM_NUMBER_H
9 #include "prism/defines.h"
10 #include "prism/util/pm_buffer.h"
12 #include <assert.h>
13 #include <stdbool.h>
14 #include <stdint.h>
15 #include <stdlib.h>
17 /**
18 * A structure represents an arbitrary-sized integer.
20 typedef struct {
21 /**
22 * The number of allocated values. length is set to 0 if the integer fits
23 * into uint32_t.
25 size_t length;
27 /**
28 * List of 32-bit integers. Set to NULL if the integer fits into uint32_t.
30 uint32_t *values;
32 /**
33 * Embedded value for small integer. This value is set to 0 if the value
34 * does not fit into uint32_t.
36 uint32_t value;
38 /**
39 * Whether or not the integer is negative. It is stored this way so that a
40 * zeroed pm_integer_t is always positive zero.