#else
/* Otherwise we only attempt it if either or both operands
would not be preserved by an NV. If both fit in NVs
- we fall through to the NV divide code below. */
- && ((left > ((UV)1 << NV_PRESERVES_UV_BITS))
- || (right > ((UV)1 << NV_PRESERVES_UV_BITS)))
+ we fall through to the NV divide code below. However,
+ as left >= right to ensure integer result here, we know that
+ we can skip the test on the right operand - right big
+ enough not to be preserved can't get here unless left is
+ also too big. */
+
+ && (left > ((UV)1 << NV_PRESERVES_UV_BITS))
#endif
) {
/* Integer division can't overflow, but it can be imprecise. */
SV *argsv = POPs;
STRLEN len;
U8 *s = (U8*)SvPVx(argsv, len);
+ SV *tmpsv;
+
+ if (PL_encoding && !DO_UTF8(argsv)) {
+ tmpsv = sv_2mortal(newSVsv(argsv));
+ s = (U8*)Perl_sv_recode_to_utf8(aTHX_ tmpsv, PL_encoding);
+ argsv = tmpsv;
+ }
XPUSHu(DO_UTF8(argsv) ? utf8_to_uvchr(s, 0) : (*s & 0xff));
+
RETURN;
}
*tmps++ = value;
*tmps = '\0';
(void)SvPOK_only(TARG);
+ if (PL_encoding)
+ Perl_sv_recode_to_utf8(aTHX_ TARG, PL_encoding);
XPUSHs(TARG);
RETURN;
}