The ovm_uint_t type

The ovm_uint_t type is the OrchIDS incarnation of the data type of unsigned machine integers.

It is defined this way in src/lang.h:

typedef struct ovm_uint_s ovm_uint_t;
struct ovm_uint_s
  gc_header_t gc;
  unsigned long val;

This is a type of garbage-collectable data. To allocate a new object of type ovm_uint_t, use the function:

ovm_var_t *ovm_uint_new(gc_t *gc_ctx, unsigned long val);

This creates a new ovm_uint_t object with value val. Its return type is the universal type ovm_var_t instead of ovm_uint_t, for practical reasons. Calling res the result, one always has TYPE(res)==T_UINT.

The result is created white, and much be gc_touch()ed before storing it into a garbage-collectable object.

The returned ovm_uint_t object res is modifiable. One can read from or write from it by using the UINT() macro (e.g., unsigned int i=UINT(res); UINT(res) = 3;).