Skip Menu |
 

This queue is for tickets about the Math-BigInt-FastCalc CPAN distribution.

Report information
The Basics
Id: 119346
Status: resolved
Priority: 0/
Queue: Math-BigInt-FastCalc

People
Owner: Nobody in particular
Requestors: felipe [...] felipegasper.com
Cc:
AdminCc:

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



Subject: BUG: Math::BigInt::FastCalc fails on as_bytes() conversion
Date: Tue, 20 Dec 2016 12:06:30 -0500
To: bug-math-bigint-fastcalc [...] rt.cpan.org
From: Felipe Gasper <felipe [...] felipegasper.com>
Download (untitled) / with headers
text/plain 1.4k
There are warnings spewed, and the result is wrong regardless. It appears that FastCalc is doing “& 0xff” on the values--maybe something thinks they’re UTF-8? Thanks for your time! ------------- NORMAL: Show quoted text
> perl -MDevel::Peek -e'use Math::BigInt; Dump( Math::BigInt->from_hex("adf67d9812365dddebb")->as_bytes() )'
SV = PV(0x7fd5f9035610) at 0x7fd5f90d27c8 REFCNT = 1 FLAGS = (TEMP,POK,IsCOW,pPOK) PV = 0x7fd5f8c420b0 "\n\337g\331\201#e\335\336\273"\0 CUR = 10 LEN = 16 COW_REFCNT = 0 ------------- FASTCALC: felipe@Macintosh-4 12:00:27 /cpanel Show quoted text
> perl -MDevel::Peek -e'use Math::BigInt try => "FastCalc"; Dump( Math::BigInt->from_hex("adf67d9812365dddebb")->as_bytes() )'
Character in 'C' format wrapped in pack at /opt/local/lib/perl5/site_perl/5.24/Math/BigInt/Lib.pm line 993. Character in 'C' format wrapped in pack at /opt/local/lib/perl5/site_perl/5.24/Math/BigInt/Lib.pm line 993. Character in 'C' format wrapped in pack at /opt/local/lib/perl5/site_perl/5.24/Math/BigInt/Lib.pm line 993. Character in 'C' format wrapped in pack at /opt/local/lib/perl5/site_perl/5.24/Math/BigInt/Lib.pm line 993. Character in 'C' format wrapped in pack at /opt/local/lib/perl5/site_perl/5.24/Math/BigInt/Lib.pm line 993. Character in 'C' format wrapped in pack at /opt/local/lib/perl5/site_perl/5.24/Math/BigInt/Lib.pm line 993. SV = PV(0x7f8a92137d50) at 0x7f8a92125618 REFCNT = 1 FLAGS = (TEMP,POK,IsCOW,pPOK) PV = 0x7f8a91cbf250 "\n\337g\331\220\30\200\240\310\300"\0 CUR = 10 LEN = 16 COW_REFCNT = 0
Download (untitled) / with headers
text/plain 133b
The problem is that I forgot to add a call to $class->_num($x) to convert $x to a scalar before $x was used as an argument to pack().


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.