# define UV_MAX PERL_UQUAD_MAX
# define UV_MIN PERL_UQUAD_MIN
# endif
+# define IV_SIZEOF 8
+# define UV_SIZEOF 8
#else
typedef long IV;
typedef unsigned long UV;
# define UV_MAX PERL_ULONG_MAX
# define UV_MIN PERL_ULONG_MIN
# endif
+# define UV_SIZEOF LONGSIZE
+# define IV_SIZEOF LONGSIZE
#endif
#ifdef USE_LONG_DOUBLE
sv = NEWSV(92,0);
if (overflowed) {
dTHR;
- if (ckWARN(WARN_UNSAFE) && (double) n > 4294967295.0)
+ if (ckWARN(WARN_UNSAFE) && (NV) n > 4294967295.0)
Perl_warner(aTHX_ WARN_UNSAFE,
"%s number > %s non-portable",
Base, max);
sv_setnv(sv, n);
}
else {
+#if UV_SIZEOF > 4
dTHR;
- if (ckWARN(WARN_UNSAFE) && u > 4294967295)
+ if (ckWARN(WARN_UNSAFE) && u > 0xffffffff)
Perl_warner(aTHX_ WARN_UNSAFE,
"%s number > %s non-portable",
Base, max);
+#endif
sv_setuv(sv, u);
}
- if ( PL_hints & HINT_NEW_BINARY)
+ if (PL_hints & HINT_NEW_BINARY)
sv = new_constant(start, s - start, "binary", sv, Nullsv, NULL);
}
break;
register UV ruv = 0;
register bool seenb = FALSE;
register bool overflowed = FALSE;
- char *nonzero = NULL;
for (; len-- && *s; s++) {
if (!(*s == '0' || *s == '1')) {
if (*s == '_')
continue; /* Note: does not check for __ and the like. */
- if (seenb == FALSE && *s == 'b' && nonzero == NULL) {
+ if (seenb == FALSE && *s == 'b' && ruv == 0) {
/* Disallow 0bbb0b0bbb... */
seenb = TRUE;
continue;
"Illegal binary digit '%c' ignored", *s);
break;
}
- } else {
- if (nonzero == NULL && *s != '0')
- nonzero = s;
}
if (!overflowed) {
register UV xuv = ruv << 1;
* is a waste of time (because the NV cannot preserve
* the low-order bits anyway): we could just remember when
* did we overflow and in the end just multiply rnv by the
- * right amount of 16-tuples. */
+ * right amount. */
rnv += (*s - '0');
}
}
if (!overflowed)
rnv = (NV) ruv;
- if (sizeof(UV) > 4 && nonzero && (s - nonzero) > 32) {
+ if (rnv > 4294967295.0) {
dTHR;
if (ckWARN(WARN_UNSAFE))
Perl_warner(aTHX_ WARN_UNSAFE,
register NV rnv = 0.0;
register UV ruv = 0;
register bool overflowed = FALSE;
- char *nonzero = NULL;
for (; len-- && *s; s++) {
if (!(*s >= '0' && *s <= '7')) {
break;
}
}
- else {
- if (nonzero == NULL && *s != '0')
- nonzero = s;
- }
if (!overflowed) {
register xuv = ruv << 3;
}
if (!overflowed)
rnv = (NV) ruv;
- if (sizeof(UV) > 4 &&
- overflowed ? rnv > 4294967295.0 :
- (nonzero && (s - nonzero) > 10 && (ruv >> 30) > 3)) {
+ if (rnv > 4294967295.0) {
dTHR;
if (ckWARN(WARN_UNSAFE))
Perl_warner(aTHX_ WARN_UNSAFE,
register UV ruv = 0;
register bool seenx = FALSE;
register bool overflowed = FALSE;
- char *nonzero = NULL;
char *hexdigit;
for (; len-- && *s; s++) {
if (!hexdigit) {
if (*s == '_')
continue; /* Note: does not check for __ and the like. */
- if (seenx == FALSE && *s == 'x' && nonzero == NULL) {
+ if (seenx == FALSE && *s == 'x' && ruv == 0) {
/* Disallow 0xxx0x0xxx... */
seenx = TRUE;
continue;
break;
}
}
- else {
- if (nonzero == NULL && *s != '0')
- nonzero = s;
- }
if (!overflowed) {
register UV xuv = ruv << 4;
}
if (!overflowed)
rnv = (NV) ruv;
- if (sizeof(UV) > 4 &&
- nonzero && (s - nonzero) > 8) {
+ if (rnv > 4294967295.0) {
dTHR;
if (ckWARN(WARN_UNSAFE))
Perl_warner(aTHX_ WARN_UNSAFE,