2
# Common methods for GLib::Array and GLib::PtrArray
4
# Re-implementation of the g_array_index and g_ptr_array_index macros
6
if idx >= length or idx < 0
7
raise IndexError, "Index #{idx} outside of bounds 0..#{length - 1}"
9
ptr = GirFFI::InOutPointer.new element_type, data_ptr + idx * element_size