Skip Menu |
 

This queue is for tickets about the JavaScript-V8 CPAN distribution.

Report information
The Basics
Id: 86729
Status: open
Priority: 0/
Queue: JavaScript-V8

People
Owner: Nobody in particular
Requestors: alankila [...] bel.fi
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.07
Fixed in: (no value)



Subject: Passing large 32-bit integer value becomes negative on 32-bit Perl
Download (untitled) / with headers
text/plain 535b
The function sv2v8 uses SvIOK to determine integer compatibility of Sv as numeric value. On 32-bit Perls, however, this will convert unsigned 32-bit value to signed 32-bit value, causing a corresponding test failure. Before the SvIOK test, something like this should be done: if (SvUOK(sv)) { UV v = SvUV(sv); return (v < 0xffffffffUL) ? (Handle<Number>)Integer::NewFromUnsigned(v) : Number::New(SvNV(v)); } which allows representation range up to 0xffffffff on 32-bit hardware, and should work correctly on 64-bit hardware.
Download (untitled) / with headers
text/plain 774b
This patch works for me. Thanks! btw, I wonder if this package is still maintained... On Fri Jul 05 06:54:00 2013, https://www.google.com/accounts/o8/id?id=AItOawkV9zn3etOeQMR64RITNw0pAvM0EFPVPqU wrote: Show quoted text
> The function sv2v8 uses SvIOK to determine integer compatibility of Sv > as numeric value. On 32-bit Perls, however, this will convert unsigned > 32-bit value to signed 32-bit value, causing a corresponding test > failure. > > Before the SvIOK test, something like this should be done: > > if (SvUOK(sv)) { > UV v = SvUV(sv); > return (v < 0xffffffffUL) ? > (Handle<Number>)Integer::NewFromUnsigned(v) : Number::New(SvNV(v)); > } > > which allows representation range up to 0xffffffff on 32-bit hardware, > and should work correctly on 64-bit hardware.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.