pv = (char*)SvRV(sv);
cur = 0;
len = 0;
- iv = (IV)pv;
- nv = (NV)(unsigned long)pv;
+ iv = PTR2IV(pv);
+ nv = PTR2NV(pv);
del_XRV(SvANY(sv));
magic = 0;
stash = 0;
SV* tmpstr;
if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv, numer)))
return SvIV(tmpstr);
- return (IV)SvRV(sv);
+ return PTR2IV(SvRV(sv));
}
if (SvREADONLY(sv) && !SvOK(sv)) {
dTHR;
#ifdef IV_IS_QUAD
DEBUG_c(PerlIO_printf(Perl_debug_log,
"0x%" PERL_PRIx64 " 2iv(%" PERL_PRIu64 " => %" PERL_PRId64 ") (as unsigned)\n",
- (UV)sv,
+ PTR2UV(sv),
(UV)SvUVX(sv), (IV)SvUVX(sv)));
#else
DEBUG_c(PerlIO_printf(Perl_debug_log,
SV* tmpstr;
if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv, numer)))
return SvUV(tmpstr);
- return (UV)SvRV(sv);
+ return PTR2UV(SvRV(sv));
}
if (SvREADONLY(sv) && !SvOK(sv)) {
dTHR;
SV* tmpstr;
if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv,numer)))
return SvNV(tmpstr);
- return (NV)(unsigned long)SvRV(sv);
+ return PTR2NV(SvRV(sv));
}
if (SvREADONLY(sv) && !SvOK(sv)) {
dTHR;
else
sv_setpv(tsv, s);
#ifdef IV_IS_QUAD
- Perl_sv_catpvf(aTHX_ tsv, "(0x%" PERL_PRIx64")", (UV)sv);
+ Perl_sv_catpvf(aTHX_ tsv, "(0x%" PERL_PRIx64")", PTR2UV(sv));
#else
Perl_sv_catpvf(aTHX_ tsv, "(0x%lx)", (unsigned long)sv);
#endif
}
if (SvNOKp(sv)) { /* See note in sv_2uv() */
/* XXXX 64-bit? IV may have better precision... */
+ /* I tried changing this for to be 64-bit-aware and
+ * the t/op/numconvert.t became very, very, angry.
+ * --jhi Sep 1999 */
if (SvTYPE(sv) < SVt_PVNV)
sv_upgrade(sv, SVt_PVNV);
SvGROW(sv, 28);
IV i;
if (SvAMAGIC(sv) && AMG_CALLun(sv,inc))
return;
- i = (IV)SvRV(sv);
+ i = PTR2IV(SvRV(sv));
sv_unref(sv);
sv_setiv(sv, i);
}
IV i;
if (SvAMAGIC(sv) && AMG_CALLun(sv,dec))
return;
- i = (IV)SvRV(sv);
+ i = PTR2IV(SvRV(sv));
sv_unref(sv);
sv_setiv(sv, i);
}
SvSETMAGIC(rv);
}
else
- sv_setiv(newSVrv(rv,classname), (IV)pv);
+ sv_setiv(newSVrv(rv,classname), PTR2IV(pv));
return rv;
}
case 'p':
if (args)
- uv = (UV)va_arg(*args, void*);
+ uv = PTR2UV(va_arg(*args, void*));
else
- uv = (svix < svmax) ? (UV)svargs[svix++] : 0;
+ uv = (svix < svmax) ? PTR2UV(svargs[svix++]) : 0;
base = 16;
goto integer;
case 'D':
#ifdef IV_IS_QUAD
- /* nothing */
+ intsize = 'q';
#else
intsize = 'l';
#endif
if (args) {
switch (intsize) {
case 'h': iv = (short)va_arg(*args, int); break;
-#ifdef IV_IS_QUAD
- default: iv = va_arg(*args, IV); break;
-#else
default: iv = va_arg(*args, int); break;
-#endif
case 'l': iv = va_arg(*args, long); break;
case 'V': iv = va_arg(*args, IV); break;
#ifdef HAS_QUAD
iv = (svix < svmax) ? SvIVx(svargs[svix++]) : 0;
switch (intsize) {
case 'h': iv = (short)iv; break;
-#ifdef IV_IS_QUAD
- default: break;
-#else
default: iv = (int)iv; break;
-#endif
case 'l': iv = (long)iv; break;
case 'V': break;
#ifdef HAS_QUAD
case 'U':
#ifdef IV_IS_QUAD
- /* nothing */
+ intsize = 'q';
#else
intsize = 'l';
#endif
case 'O':
#ifdef IV_IS_QUAD
- /* nothing */
+ intsize = 'q';
#else
intsize = 'l';
#endif
if (args) {
switch (intsize) {
case 'h': uv = (unsigned short)va_arg(*args, unsigned); break;
-#ifdef UV_IS_QUAD
- default: uv = va_arg(*args, UV); break;
-#else
default: uv = va_arg(*args, unsigned); break;
-#endif
case 'l': uv = va_arg(*args, unsigned long); break;
case 'V': uv = va_arg(*args, UV); break;
#ifdef HAS_QUAD
uv = (svix < svmax) ? SvUVx(svargs[svix++]) : 0;
switch (intsize) {
case 'h': uv = (unsigned short)uv; break;
-#ifdef UV_IS_QUAD
- default: break;
-#else
default: uv = (unsigned)uv; break;
-#endif
case 'l': uv = (unsigned long)uv; break;
case 'V': break;
#ifdef HAS_QUAD
dig = uv & 1;
*--eptr = '0' + dig;
} while (uv >>= 1);
- if (alt && *eptr != '0')
- *--eptr = '0';
+ if (alt) {
+ esignbuf[esignlen++] = '0';
+ esignbuf[esignlen++] = 'b';
+ }
break;
default: /* it had better be ten or less */
do {
if (args) {
switch (intsize) {
case 'h': *(va_arg(*args, short*)) = i; break;
-#ifdef IV_IS_QUAD
- default: *(va_arg(*args, IV*)) = i; break;
-#else
default: *(va_arg(*args, int*)) = i; break;
-#endif
case 'l': *(va_arg(*args, long*)) = i; break;
case 'V': *(va_arg(*args, IV*)) = i; break;
#ifdef HAS_QUAD