Skip Menu |

This queue is for tickets about the JavaScript CPAN distribution.

Report information
The Basics
Id: 26474
Status: new
Priority: 0/
Queue: JavaScript

People
Owner: Nobody in particular
Requestors: ntyni [...] iki.fi
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.03
Fixed in: (no value)



Subject: t/02-types-from-perl.t fails with 64-bit Perl integers
As discussed in #26411, t/02-types-from-perl.t is failing for me on x86_64: not ok 6 - Really big integers # Failed test 'Really big integers' # in t/02-types-from-perl.t at line 14. This is because with a USE_64_BIT_INT Perl, the value is really stored as an integer inside Perl, but it won't fit into a JS 32-bit integer. The attached patch converts the value into a JS double if necessary. This makes the test work for me on both x86 and x86_64. Cheers, -- Niko Tyni ntyni@iki.fi
Subject: int64.patch
Index: PJS_TypeConversion.c =================================================================== --- PJS_TypeConversion.c (revision 444) +++ PJS_TypeConversion.c (working copy) @@ -77,7 +77,11 @@ } else if (SvIOK(ref)) { /* Returned value is an integer */ - *rval = INT_TO_JSVAL(SvIV(ref)); + if (SvIV(ref) <= JSVAL_INT_MAX) { + *rval = INT_TO_JSVAL(SvIV(ref)); + } else { + JS_NewDoubleValue(cx, (double) SvIV(ref), rval); + } } else if (SvNOK(ref)) { JS_NewDoubleValue(cx, SvNV(ref), rval);