68#define NUMBER_BOOL(v) \
71 .number_type = NT_INT1, .value = v \
77#define NUMBER_CHAR(v) \
80 .number_type = NT_INT8, .value = v \
87#define NUMBER_SHORT(v) \
90 .number_type = NT_INT16, .value = v \
96#define NUMBER_INT(v) \
99 .number_type = NT_INT32, .value = v \
105#define NUMBER_LONG(v) \
108 .number_type = NT_INT64, .value = v \
114#define NUMBER_FROM_TYPE_VAL(t, v) \
117 .number_type = t, .value = v \
123#define NUMBERS_TYPEQUIV(A, B) \
124 (A.number_type == B.number_type && A.pointer_depth == B.pointer_depth)
NumberType token_type_to_number_type(int token_type)
Convert a TokenType to a NumberType.
Definition: number.c:20
struct Number Number
Container for various kinds of number data.
static const char * numberTypeFormatStrings[]
Format strings for each data type.
Definition: number.h:51
NumberType max_numbertype_for_val(long long int value)
Finds the maximum NumberType possible for a given value.
Definition: number.c:66
int number_to_token_type(Number number)
Definition: number.c:44
static const int numberTypeByteSizes[]
Size of each NumberType.
Definition: number.h:28
static const unsigned long long int numberTypeMaxValues[]
Max value of each NumberType.
Definition: number.h:40
static const char * numberTypeNames[]
Names of each NumberType.
Definition: number.h:46
static const int numberTypeBitSizes[]
Bit size of each NumberType.
Definition: number.h:35
NumberType
Types of numbers supported by Purple.
Definition: number.h:17
@ NT_INT16
Definition: number.h:20
@ NT_INT64
Definition: number.h:22
@ NT_INT1
Definition: number.h:18
@ NT_INT32
Definition: number.h:21
@ NT_INT8
Definition: number.h:19
Container for various kinds of number data.
Definition: number.h:56
long long int value
Definition: number.h:60
int pointer_depth
Definition: number.h:62
NumberType number_type
Definition: number.h:58