zgetinterval(i_ctx_t *i_ctx_p)
{
    os_ptr op = osp;
    os_ptr op1 = op - 1;
    os_ptr op2 = op1 - 1;
    uint index;
    uint count;

    switch (r_type(op2)) {
        default:
            return_op_typecheck(op2);
        case t_array:
        case t_string:
        case t_mixedarray:
        case t_shortarray:;
    }
    check_read(*op2);
    check_int_leu(*op1, r_size(op2));
    index = op1->value.intval;
    check_int_leu(*op, r_size(op2) - index);
    count = op->value.intval;
    switch (r_type(op2)) {
        case t_array:
            op2->value.refs += index;
            break;
        case t_string:
            op2->value.bytes += index;
            break;
        case t_mixedarray: {
            const ref_packed *packed = op2->value.packed;

            for (; index--;)
                packed = packed_next(packed);
            op2->value.packed = packed;
            break;
        }
        case t_shortarray:
            op2->value.packed += index;
            break;
    }
    r_set_size(op2, count);
    pop(2);
    return 0;
}
zgetinterval(i_ctx_t *i_ctx_p)
{
    os_ptr op = osp;
    os_ptr op1 = op - 1;
    os_ptr op2 = op1 - 1;
    uint index;
    uint count;

    switch (r_type(op2)) {
        default:
            return_op_typecheck(op2);
        case t_array:
        case t_string:
        case t_mixedarray:
        case t_shortarray:;
    }
    check_read(*op2);
    check_int_leu(*op1, r_size(op2));
    index = op1->value.intval;
    check_int_leu(*op, r_size(op2) - index);
    count = op->value.intval;
    switch (r_type(op2)) {
        case t_array:
            op2->value.refs += index;
            break;
        case t_string:
            op2->value.bytes += index;
            break;
        case t_mixedarray: {
            const ref_packed *packed = op2->value.packed;

            for (; index--;)
                packed = packed_next(packed);
            op2->value.packed = packed;
            break;
        }
        case t_shortarray:
            op2->value.packed += index;
            break;
    }
    r_set_size(op2, count);
    pop(2);
    return 0;
}