Skip to content

Instantly share code, notes, and snippets.

Created June 1, 2012 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2854662 to your computer and use it in GitHub Desktop.
Save anonymous/2854662 to your computer and use it in GitHub Desktop.
VTABLE PMC * get_pmc_keyed_int(INTVAL pos) {
INTVAL elems;
INTVAL start;
PMC **slots;
GET_ATTR_elems(INTERP, SELF, elems);
if (pos < 0)
pos += elems;
if (pos < 0)
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
"QRPA: index out of bounds");
if (pos >= elems)
return PMCNULL;
GET_ATTR_start(INTERP, SELF, start);
GET_ATTR_slots(INTERP, SELF, slots);
return slots[start + pos];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment