* Some of the methods should always be private to the implementation, and some
* should eventually be made public */
+#define TO_INTERNAL_SIZE(x) (x * sizeof(UV)) /* Internally things are UVs */
+#define FROM_INTERNAL_SIZE(x) (x / sizeof(UV))
#define INVLIST_INITIAL_LEN 10
PERL_STATIC_INLINE UV*
PERL_ARGS_ASSERT_INVLIST_LEN;
- return SvCUR(invlist) / sizeof(UV);
+ return FROM_INTERNAL_SIZE(SvCUR(invlist));
}
PERL_STATIC_INLINE UV
PERL_ARGS_ASSERT_INVLIST_MAX;
- return SvLEN(invlist) / sizeof(UV);
+ return FROM_INTERNAL_SIZE(SvLEN(invlist));
}
PERL_STATIC_INLINE void
PERL_ARGS_ASSERT_INVLIST_SET_LEN;
- SvCUR_set(invlist, len * sizeof(UV));
+ SvCUR_set(invlist, TO_INTERNAL_SIZE(len));
}
#ifndef PERL_IN_XSUB_RE
}
/* Allocate the initial space */
- return newSV(initial_size * sizeof(UV));
+ return newSV(TO_INTERNAL_SIZE(initial_size));
}
#endif
PERL_ARGS_ASSERT_INVLIST_EXTEND;
- SvGROW((SV *)invlist, new_max * sizeof(UV));
+ SvGROW((SV *)invlist, TO_INTERNAL_SIZE(new_max));
}
PERL_STATIC_INLINE void
}
#undef INVLIST_INITIAL_LENGTH
+#undef TO_INTERNAL_SIZE
+#undef FROM_INTERNAL_SIZE
/* End of inversion list object */