Cyclone Scheme  0.28.0
Macros | Typedefs
Immediate objects

Objects that do not require memory allocation. More...

Macros

#define CYC_FIXNUM_MAX   1073741823
 
#define CYC_FIXNUM_MIN   -1073741824
 
#define is_object_type(x)   ((x != NULL) && !is_value_type(x))
 
#define is_value_type(x)   ((unsigned long)(x) & (unsigned long)3)
 
#define obj_char2obj(c)   ((void *)((((uintptr_t)c)<<2) | 2))
 
#define obj_int2obj(c)   ((void *)((((long)c)*2) | 1))
 
#define obj_is_char(x)   (((unsigned long)(x) & (unsigned long)3) == 2)
 
#define obj_is_int(x)   ((unsigned long)(x) & (unsigned long)1)
 
#define obj_obj2char(x)   (char_type)((uintptr_t)(x)>>2)
 
#define obj_obj2int(x)   ((long)((uintptr_t)x)>>1)
 

Typedefs

typedef uint32_t char_type
 

Detailed Description

Objects that do not require memory allocation.

Immediate objects (also known as value types) are stored directly within the bits that would otherwise be a pointer to an object type. Since all of the data is contained in those bits, a value type is never allocated on the heap and never needs to be garbage collected, making them very efficient.

Depending on the underlying architecture, compiler, etc these types have extra least significant bits that can be used to mark them as values instead of objects (IE, pointer to a tagged object). On many machines, addresses are multiples of four, leaving the two least significant bits free - from lisp in small pieces.

The possible types are: