Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 37 lines (30 sloc) 0.778 kb
namespace factor
{
inline cell array_nth(array *array, cell slot)
{
#ifdef FACTOR_DEBUG
FACTOR_ASSERT(slot < array_capacity(array));
FACTOR_ASSERT(array->type() == ARRAY_TYPE);
#endif
return array->data()[slot];
}
inline void factor_vm::set_array_nth(array *array, cell slot, cell value)
{
#ifdef FACTOR_DEBUG
FACTOR_ASSERT(slot < array_capacity(array));
FACTOR_ASSERT(array->type() == ARRAY_TYPE);
#endif
cell *slot_ptr = &array->data()[slot];
*slot_ptr = value;
write_barrier(slot_ptr);
}
struct growable_array {
cell count;
data_root<array> elements;
explicit growable_array(factor_vm *parent, cell capacity = 10) :
count(0), elements(parent->allot_array(capacity,false_object),parent) {}
void add(cell elt);
void append(array *elts);
void trim();
};
}
Jump to Line
Something went wrong with that request. Please try again.