Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^22: supporting quads on 32 bit Perl

by salva (Monsignor)
on Jun 04, 2012 at 21:33 UTC ( #974383=note: print w/ replies, xml ) Need Help??


in reply to Re^21: supporting quads on 32 bit Perl
in thread supporting quads on 32 bit Perl

0x43efe00000000000 is 0100001111101111111000000000000000000000000000000000000000000000 (you were missing the first 0 bit).

Removing the sign bit and the exponent and prepending the implicit 1., results in 1.1111111000000000000000000000000000000000000000000000. So the number is 0b1.1111111 * 2** (0b10000111110 - 1023) = 0b1.1111111 * 2 ** 63 = 0xff00_0000_0000_0000. The number can be represented precisely as an NV because its last bits are zero.

The problem seems related to the MS compiler not converting correctly between NVs and uint64.

Could you try the current GitHub version and post here the output from MSC.t?


Comment on Re^22: supporting quads on 32 bit Perl
Select or Download Code
Re^23: supporting quads on 32 bit Perl
by bulk88 (Priest) on Jun 04, 2012 at 22:50 UTC
    I can produce for you the asm or ST register snapshots of MS VC int64 to double/NV cast if its any help. Next thing is, I'm using a DEBUGGING perl, so its compiled as -Od. VC might be doing something different conversion wise between -O1 and -Od. Then again, ikegami got the same test fail Re: supporting quads on 32 bit Perl (0.23) and he compiled probably as -O1 since thats what ActivePerl's Config.pm is set with. Got latest github. First try of MSC.t.
    C:\Documents and Settings\Owner\Desktop\cpan libs\salva-p5-Math-Int64- +f0367cb>pe rl ./t/msc.t 1..3 ok 1 - uint64 to NV conversion ok 2 - uint64 to NV conversion 2 not ok 3 - uint64 to NV conversion 3 # Failed test 'uint64 to NV conversion 3' # at ./t/msc.t line 15. Undefined subroutine &main::uint64 called at ./t/msc.t line 15. # Looks like you failed 1 test of 3. # Looks like your test exited with 255 just after 3. C:\Documents and Settings\Owner\Desktop\cpan libs\salva-p5-Math-Int64- +f0367cb>
    Fixed the missing import.
    C:\Documents and Settings\Owner\Desktop\cpan libs\salva-p5-Math-Int64- +f0367cb>pe rl ./t/msc.t 1..3 ok 1 - uint64 to NV conversion ok 2 - uint64 to NV conversion 2 not ok 3 - uint64 to NV conversion 3 # Failed test 'uint64 to NV conversion 3' # at ./t/msc.t line 15. # nv converts to uint64 as 9223372036854775808, expected: 183746864796 +71623680 # Looks like you failed 1 test of 3. C:\Documents and Settings\Owner\Desktop\cpan libs\salva-p5-Math-Int64- +f0367cb>
    Thanks for the lesson in binary math. The hex to binary converter I used, I think I highlighted wrong for the copy in in the converter, and the first 0 was chopped off. From what I read about floating points a couple days ago, exact powers of 2 floating points suffer no rounding/precision loss, and thats what you are testing here right? I might update this post soon if I discover anything interesting.

    update

    I rewrote mu64_eqn.
    SV * mu64_eqn(self, other, rev = NULL) SV *self SV *other SV *rev = NO_INIT PREINIT: uint64_t selfu64; uint64_t otheru64; CODE: selfu64 = SvU64x(self); otheru64 = SvU64(aTHX_ other); RETVAL = (selfu64 == otheru64 ? &PL_sv_yes : &PL_sv_no );
    which in C is
    XS(XS_Math__UInt64__eqn); /* prototype to pass -Wmissing-prototypes */ XS(XS_Math__UInt64__eqn) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif if (items < 2 || items > 3) croak_xs_usage(cv, "self, other, rev = NULL"); { SV * self = ST(0); SV * other = ST(1); SV * rev; uint64_t selfu64; uint64_t otheru64; SV * RETVAL; selfu64 = SvU64x(self); otheru64 = SvU64(aTHX_ other); RETVAL = (selfu64 == otheru64 ? &PL_sv_yes : &PL_sv_no ); ST(0) = RETVAL; sv_2mortal(ST(0)); } XSRETURN(1); }
    When the test fails, copied from watch window in hex and decimal
    selfu64 0xff00000000000000 unsigned __int64 otheru64 0x8000000000000000 unsigned __int64 selfu64 18374686479671623680 unsigned __int64 otheru64 9223372036854775808 unsigned __int64
    Hmmm, in SvU64
    if (SvNOK(sv)) { NV nv = SvNV(sv); if (may_die_on_overflow && ( (nv < 0) || (nv >= NV_0x1p64)) ) overflow(aTHX_ out_ +of_bounds_error_u); return nv; } 397: return nv; 100045F6 DD 45 B0 fld qword ptr [nv] 100045F9 E8 6E 04 01 00 call _ftol2 (10014A6Ch) 100045FE EB 4D jmp 1000464D
    _fto12 is a static linked piece of code in the DLL tossed in by the compiler, its not part of the CRT/not imported from the CRT DLL, its asm is
    _ftol2: 10014A6C 55 push ebp 10014A6D 8B EC mov ebp,esp 10014A6F 83 EC 20 sub esp,20h 10014A72 83 E4 F0 and esp,0FFFFFFF0h 10014A75 D9 C0 fld st(0) 10014A77 D9 54 24 18 fst dword ptr [esp+18h] 10014A7B DF 7C 24 10 fistp qword ptr [esp+10h] 10014A7F DF 6C 24 10 fild qword ptr [esp+10h] 10014A83 8B 54 24 18 mov edx,dword ptr [esp+18h] 10014A87 8B 44 24 10 mov eax,dword ptr [esp+10h] 10014A8B 85 C0 test eax,eax 10014A8D 74 3C je integer_QnaN_or_zero (10014ACBh) + arg_is_not_integer_QnaN: 10014A8F DE E9 fsubp st(1),st 10014A91 85 D2 test edx,edx 10014A93 79 1E jns positive (10014AB3h) 10014A95 D9 1C 24 fstp dword ptr [esp] 10014A98 8B 0C 24 mov ecx,dword ptr [esp] 10014A9B 81 F1 00 00 00 80 xor ecx,80000000h 10014AA1 81 C1 FF FF FF 7F add ecx,7FFFFFFFh 10014AA7 83 D0 00 adc eax,0 10014AAA 8B 54 24 14 mov edx,dword ptr [esp+14h] 10014AAE 83 D2 00 adc edx,0 10014AB1 EB 2C jmp localexit (10014ADFh) positive: 10014AB3 D9 1C 24 fstp dword ptr [esp] 10014AB6 8B 0C 24 mov ecx,dword ptr [esp] 10014AB9 81 C1 FF FF FF 7F add ecx,7FFFFFFFh 10014ABF 83 D8 00 sbb eax,0 10014AC2 8B 54 24 14 mov edx,dword ptr [esp+14h] 10014AC6 83 DA 00 sbb edx,0 10014AC9 EB 14 jmp localexit (10014ADFh) integer_QnaN_or_zero: 10014ACB 8B 54 24 14 mov edx,dword ptr [esp+14h] 10014ACF F7 C2 FF FF FF 7F test edx,7FFFFFFFh 10014AD5 75 B8 jne arg_is_not_integer_QnaN (10014A8 +Fh) 10014AD7 D9 5C 24 18 fstp dword ptr [esp+18h] 10014ADB D9 5C 24 18 fstp dword ptr [esp+18h] localexit: 10014ADF C9 leave 10014AE0 C3 ret
    Will need a while to look through this asm.

    10014A7B DF 7C 24 10 fistp qword ptr [esp+10h]
    puts 8000000000000000 in esp+10h, 0x8000000000000000 is what winds up in the uint64 in ::Int64. not 0xFF*. From x86 manual, "Integer Indefinite value (0x80000000) will be returned." from FISTP docs, "If the invalid operation exception is masked, the integer indefinite value is stored in the destination operand."

    10014A7B DF 7C 24 10 fistp qword ptr [esp+10h]
    which generated the 0x80* value, right after it executed, FPU status register was 0x3921 according to VS debugger. I don't understand LE/BE and the diagrams online of the fpu status register to decode that 0x3921.

    Update, the error is fpu invalid operation, and it has to do with the sign bit on the future int64. Given
    void NVTest() PREINIT: double d1; double d2; unsigned __int64 i64; unsigned __int64 i642; PPCODE: d1 = pow(2.0, 56.0); d1 *= 128.0; i64 = 0xFF00000000000000; _controlfp( _EM_INEXACT , _MCW_EM); i642 = (unsigned __int64)d1; d2 = (double)i64; 0;
    If d1 *= 128.0;, exception thrown/crash. If d1 *= 127.0;, then int64 0x7f00* is created, and no exception thrown. Not sure whose bug this is or how to fix it. I think its simply, fistp creates a signed int64, if the floating point higher than the max signed (0xFF00* has sign bit on for signed), exception thrown.

    Update, MSVC bug! https://connect.microsoft.com/VisualStudio/feedback/details/106531/co
      From what I read about floating points a couple days ago, exact powers of 2 floating points suffer no rounding/precision loss
      Well, not exactly. IEEE 754 double-precision floats can represent precisely any number with 53 binary digits (and that covers all the integers up to 2**53 and all the powers of two).

      It is the same as using decimal scientific notation. For instance, with a number of the form XXXeXX you can represent precisely any integer between 0 an 999, but then you can also represent precisely 5670, 56700, 567000, 5670000, etc.

      The reason of the MSC.t is that at some point, one of the errors on the compilation logs from the ActiveState build server was:

      Int64.xs(340) : error C2520: conversion from unsigned __int64 to doubl +e not implemented, use signed __int64
      There were other places where NVs where converted to uint64 and back even if the compiler didn't spot them, so I added the MSC.t tests to ensure that they were correctly handled... but the thing is that they are not! (see also this).

      Now, as a work around, I have implemented my own NV->uint64 conversion that will be used instead of the default one when the module is compiled by any MS compiler.

      Could you test the git version again?

        Its
        #if ((defined _MSC_VER) || (defined INT64_MY_NV2U64))
        not
        #if ((defined _MSV_VER) || (defined INT64_MY_NV2U64))
        Typo i kno.

        After fixing that.
        C:\Documents and Settings\Owner\Desktop\cpan libs\salva-p5-Math-Int64- +09023f2>nm ake clean & perl makefile.pl & nmake install & nmake test Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. C:\perl512\bin\perl.exe -MExtUtils::Command -e "rm_f" -- *.li +b core co re.[0-9] core.[0-9][0-9] Int64.bso blib\arch\auto\Math\Int64\extralib +s.ld pm_t o_blib.ts core.[0-9][0-9][0-9][0-9] Int64.x Int64.bs perl.exe tmon.o +ut blib\a rch\auto\Math\Int64\extralibs.all *.obj pm_to_blib blibdirs.ts core. +[0-9][0-9] [0-9][0-9][0-9] *perl.core core.*perl.*.? Makefile.aperl perl Int64. +def core. [0-9][0-9][0-9] mon.out libInt64.def perlmain.c perl.exe so_location +s Int64.c Int64.exp C:\perl512\bin\perl.exe -MExtUtils::Command -e "rm_rf" -- *.p +db blib C:\perl512\bin\perl.exe -MExtUtils::Command -e "mv" -- Makefil +e Makefile .old > NUL Using NV backend Checking if your kit is complete... Looks good Writing Makefile for Math::Int64 Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. cp lib/Math/Int64.pm blib\lib\Math\Int64.pm cp lib/Math/Int64/die_on_overflow.pm blib\lib\Math\Int64\die_on_overfl +ow.pm cp lib/Math/Int64/native_if_available.pm blib\lib\Math\Int64\native_if +_available .pm C:\perl512\bin\perl.exe C:\perl512\lib\ExtUtils\xsubpp -nolin +enumbers -typemap C:\perl512\lib\ExtUtils\typemap Int64.xs > Int64.xsc && C:\p +erl512\bin \perl.exe -MExtUtils::Command -e "mv" -- Int64.xsc Int64.c cl -c -I. -nologo -GF -W3 -Od -MD -Zi -DDEBUGGING -DWIN32 -D +_CONSOLE - DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_S +YS -DUSE_P ERLIO -Od -MD -Zi -DDEBUGGING -DVERSION=\"0.24\" -DXS_VERSION=\"0. +24\" "-IC :\perl512\lib\CORE" -DINT64_BACKEND_NV Int64.c Int64.c Int64.c(69) : warning C4244: 'initializing' : conversion from 'NV' to +'uint64_t' , possible loss of data Int64.c(70) : warning C4244: 'initializing' : conversion from 'NV' to +'uint64_t' , possible loss of data Int64.c(292) : warning C4244: 'return' : conversion from 'NV' to 'int6 +4_t', poss ible loss of data Int64.c(381) : warning C4244: 'initializing' : conversion from 'int64_ +t' to 'IV' , possible loss of data Int64.c(386) : warning C4244: 'initializing' : conversion from 'int64_ +t' to 'UV' , possible loss of data Int64.c(390) : warning C4244: 'function' : conversion from 'int64_t' t +o 'const N V', possible loss of data Int64.c(396) : warning C4244: 'initializing' : conversion from 'uint64 +_t' to 'UV ', possible loss of data Int64.c(399) : warning C4244: 'function' : conversion from 'uint64_t' +to 'const NV', possible loss of data Int64.c(411) : warning C4244: 'initializing' : conversion from 'uint64 +_t' to 'ch ar', possible loss of data Int64.c(673) : warning C4244: 'function' : conversion from 'int64_t' t +o 'const I V', possible loss of data Int64.c(709) : warning C4244: 'function' : conversion from 'uint64_t' +to 'const UV', possible loss of data Int64.c(740) : warning C4244: '=' : conversion from 'int64_t' to 'char +', possibl e loss of data Int64.c(770) : warning C4244: '=' : conversion from 'uint64_t' to 'cha +r', possib le loss of data Int64.c(1017) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const IV', possible loss of data Int64.c(1047) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const UV', possible loss of data Int64.c(1070) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const IV', possible loss of data Int64.c(1093) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const UV', possible loss of data Int64.c(1116) : warning C4244: 'function' : conversion from 'int64_t' +to 'const IV', possible loss of data Int64.c(1139) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const IV', possible loss of data Int64.c(1203) : warning C4101: 'rev' : unreferenced local variable Int64.c(1202) : warning C4101: 'other' : unreferenced local variable Int64.c(1229) : warning C4101: 'rev' : unreferenced local variable Int64.c(1228) : warning C4101: 'other' : unreferenced local variable Int64.c(1634) : warning C4101: 'rev' : unreferenced local variable Int64.c(1659) : warning C4101: 'rev' : unreferenced local variable Int64.c(1917) : warning C4101: 'rev' : unreferenced local variable Int64.c(1916) : warning C4101: 'other' : unreferenced local variable Int64.c(1940) : warning C4101: 'rev' : unreferenced local variable Int64.c(1939) : warning C4101: 'other' : unreferenced local variable Int64.c(1963) : warning C4101: 'rev' : unreferenced local variable Int64.c(1962) : warning C4101: 'other' : unreferenced local variable Int64.c(1986) : warning C4101: 'rev' : unreferenced local variable Int64.c(1985) : warning C4101: 'other' : unreferenced local variable Int64.c(2009) : warning C4101: 'rev' : unreferenced local variable Int64.c(2008) : warning C4101: 'other' : unreferenced local variable Int64.c(2032) : warning C4101: 'rev' : unreferenced local variable Int64.c(2031) : warning C4101: 'other' : unreferenced local variable Int64.c(2055) : warning C4101: 'rev' : unreferenced local variable Int64.c(2054) : warning C4101: 'other' : unreferenced local variable Int64.c(2078) : warning C4101: 'rev' : unreferenced local variable Int64.c(2077) : warning C4101: 'other' : unreferenced local variable Int64.c(2103) : warning C4101: 'rev' : unreferenced local variable Int64.c(2102) : warning C4101: 'other' : unreferenced local variable Int64.c(2489) : warning C4101: 'rev' : unreferenced local variable Int64.c(2514) : warning C4101: 'rev' : unreferenced local variable Int64.c(2772) : warning C4101: 'rev' : unreferenced local variable Int64.c(2771) : warning C4101: 'other' : unreferenced local variable Int64.c(2795) : warning C4101: 'rev' : unreferenced local variable Int64.c(2794) : warning C4101: 'other' : unreferenced local variable Int64.c(2818) : warning C4101: 'rev' : unreferenced local variable Int64.c(2817) : warning C4101: 'other' : unreferenced local variable Int64.c(2841) : warning C4101: 'rev' : unreferenced local variable Int64.c(2840) : warning C4101: 'other' : unreferenced local variable Int64.c(2864) : warning C4101: 'rev' : unreferenced local variable Int64.c(2863) : warning C4101: 'other' : unreferenced local variable Int64.c(2887) : warning C4101: 'rev' : unreferenced local variable Int64.c(2886) : warning C4101: 'other' : unreferenced local variable Int64.c(2910) : warning C4101: 'rev' : unreferenced local variable Int64.c(2909) : warning C4101: 'other' : unreferenced local variable c:\documents and settings\owner\desktop\cpan libs\salva-p5-math-int64- +09023f2\in t64.c(206) : warning C4715: 'SvSI64' : not all control paths return a +value c:\documents and settings\owner\desktop\cpan libs\salva-p5-math-int64- +09023f2\in t64.c(216) : warning C4715: 'SvSU64' : not all control paths return a +value Running Mkbootstrap for Math::Int64 () C:\perl512\bin\perl.exe -MExtUtils::Command -e "chmod" -- 644 +Int64.bs C:\perl512\bin\perl.exe -MExtUtils::Mksymlists -e "Mksymlists +('NAME'=>\ "Math::Int64\", 'DLBASE' => 'Int64', 'DL_FUNCS' => { }, 'FUNCLIST' => + [], 'IMPO RTS' => { }, 'DL_VARS' => []);" link -out:blib\arch\auto\Math\Int64\Int64.dll -dll -nologo -no +defaultlib -debug -libpath:"c:\perl512\lib\CORE" -machine:x86 Int64.obj C:\p +erl512\lib \CORE\perl512.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winsp +ool.lib c omdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32. +lib uuid.l ib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib c +omctl32.li b msvcrt.lib -def:Int64.def Creating library blib\arch\auto\Math\Int64\Int64.lib and object bli +b\arch\aut o\Math\Int64\Int64.exp if exist blib\arch\auto\Math\Int64\Int64.dll.manifest mt -nolo +go -manife st blib\arch\auto\Math\Int64\Int64.dll.manifest -outputresource:blib\a +rch\auto\M ath\Int64\Int64.dll;2 if exist blib\arch\auto\Math\Int64\Int64.dll.manifest del blib +\arch\auto \Math\Int64\Int64.dll.manifest C:\perl512\bin\perl.exe -MExtUtils::Command -e "chmod" -- 755 +blib\arch\ auto\Math\Int64\Int64.dll C:\perl512\bin\perl.exe -MExtUtils::Command -e "cp" -- Int64.b +s blib\arc h\auto\Math\Int64\Int64.bs C:\perl512\bin\perl.exe -MExtUtils::Command -e "chmod" -- 644 +blib\arch\ auto\Math\Int64\Int64.bs Files found in blib\arch: installing files in blib\lib into architectu +re depende nt library tree Installing C:\perl512\site\lib\auto\Math\Int64\Int64.dll Installing C:\perl512\site\lib\auto\Math\Int64\Int64.exp Installing C:\perl512\site\lib\auto\Math\Int64\Int64.ilk Installing C:\perl512\site\lib\auto\Math\Int64\Int64.lib Installing C:\perl512\site\lib\auto\Math\Int64\Int64.pdb Appending installation info to c:\perl512\lib/perllocal.pod Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. C:\perl512\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib\lib', 'blib\arch')" t/*.t t/as_int64.t ............ ok t/die_on_overflow.t ..... ok t/Math-Int64-Native.t ... ok t/Math-Int64.t .......... ok t/Math-UInt64-Native.t .. ok t/Math-UInt64.t ......... ok t/MSC.t ................. ok t/pods.t ................ skipped: Only the author needs to check that + POD docs are right All tests successful. Files=8, Tests=256, 1 wallclock secs ( 0.19 usr + 0.03 sys = 0.22 C +PU) Result: PASS C:\Documents and Settings\Owner\Desktop\cpan libs\salva-p5-Math-Int64- +09023f2>
        I guess we are done then unless you can think of more tests or something you want to try. I embedded it into my module a couple days ago and wrote a *small* test suite for the Math::Int64 part and everything works fine so the build/module tests were the only problems. I decided to NOT use the C API of Math::Int64 and instead used the something_*native*_something Perl subs and called them from XS for stability reasons (although Math::In64 is 4-5 years old, so some will argue all of its API is stable) and also to avoid loading Math::Int64 unless the caller/user does it. Now time for my opinion. I see you versioned the C API, and the version numbers of the C API aren't the mainline module's numbers (good, otherwise a nightmare matching packager build version numbers), and you didn't go the DLL linking route (nightmareish if the dlls are renamed/PAR, or duplicate names exist in the path, someone will say using OS DLL linking is much more efficient than doing it through Perl packages and hashs). You did a better design than Perl TK's C function import/exporter. In Perl TK, an IV with a pointer to a C static struct of function pointers is saved in Perl TK's package as a global. There is poor versioning, the struct does have a length of the struct as the 1st member, and its checked in the client against what the client's Perl TK headers said the struct size was supposed to be. The problem is if the order of the function pointers is changed or they are renamed, but the total length wasn't changed, a crash results. With your system, order is irrelevant, and if a single C function name was removed or changed, an error is thrown. Thats good. I've also realize that most of the build problems were because you wrote ::Int64 in GNUC, not C jkjk. I assume ::Int64 has worked from day 1 on Strawberry Perl. I also tested the latest github (same as above with msc_ver mistake), with Strawberry Perl, nothing to note.
        C:\Documents and Settings\Owner\Desktop\cpan libs\salva-p5-Math-Int64- +09023f2>pe rl makefile.pl & dmake install & dmake test Using NV backend Writing Makefile for Math::Int64 Skip blib\lib\Math\Int64.pm (unchanged) Skip blib\lib\Math\Int64\die_on_overflow.pm (unchanged) Skip blib\lib\Math\Int64\native_if_available.pm (unchanged) gcc -c -I. -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE - +DPERL_IMPL ICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields - +DPERL_MSVC RT_READFIX -s -O2 -DVERSION=\"0.24\" -DXS_VERSION=\"0.24\" + "-IC:\spe rl\perl\lib\CORE" -DINT64_BACKEND_NV Int64.c Int64.c: In function 'SvI64': Int64.c:291: warning: integer constant is too large for 'long' type Int64.c:291: warning: this decimal constant is unsigned only in ISO C9 +0 Int64.c:291: warning: integer constant is too large for 'long' type Int64.c:291: warning: this decimal constant is unsigned only in ISO C9 +0 Int64.c: In function 'SvU64': Int64.c:370: warning: integer constant is too large for 'long' type Int64.c:370: warning: integer constant is too large for 'long' type Running Mkbootstrap for Math::Int64 () C:\sperl\perl\bin\perl.exe -MExtUtils::Command -e "chmod" -- 644 Int64 +.bs dlltool --def Int64.def --output-exp dll.exp g++ -o blib\arch\auto\Math\Int64\Int64.dll -Wl,--base-file -Wl,dll.bas +e -mdll -s -L"C:\sperl\perl\lib\CORE" -L"C:\sperl\c\lib" Int64.o -Wl,--image-bas +e,0x7d4000 00 C:\sperl\perl\lib\CORE\libperl512.a -lmoldname -lkernel32 -luser32 + -lgdi32 - lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi3 +2 -luuid - lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 dll.exp dlltool --def Int64.def --base-file dll.base --output-exp dll.exp g++ -o blib\arch\auto\Math\Int64\Int64.dll -mdll -s -L"C:\sperl\perl\l +ib\CORE" - L"C:\sperl\c\lib" Int64.o -Wl,--image-base,0x7d400000 C:\sperl\perl\l +ib\CORE\li bperl512.a -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg3 +2 -ladvapi 32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwin +mm -lversi on -lodbc32 -lodbccp32 -lcomctl32 dll.exp C:\sperl\perl\bin\perl.exe -MExtUtils::Command -e "chmod" -- 755 blib\ +arch\auto\ Math\Int64\Int64.dll C:\sperl\perl\bin\perl.exe -MExtUtils::Command -e "cp" -- Int64.bs bli +b\arch\aut o\Math\Int64\Int64.bs C:\sperl\perl\bin\perl.exe -MExtUtils::Command -e "chmod" -- 644 blib\ +arch\auto\ Math\Int64\Int64.bs Files found in blib\arch: installing files in blib\lib into architectu +re depende nt library tree Installing C:\sperl\perl\site\lib\auto\Math\Int64\Int64.dll Installing C:\sperl\perl\site\lib\auto\Math\Int64\Int64.exp Installing C:\sperl\perl\site\lib\auto\Math\Int64\Int64.ilk Installing C:\sperl\perl\site\lib\auto\Math\Int64\Int64.lib Installing C:\sperl\perl\site\lib\auto\Math\Int64\Int64.pdb Installing C:\sperl\perl\site\lib\Math\Int64.pm Appending installation info to C:\sperl\perl\lib/perllocal.pod C:\sperl\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harnes +s(0, 'blib \lib', 'blib\arch')" t/*.t t/as_int64.t ............ ok t/die_on_overflow.t ..... ok t/Math-Int64-Native.t ... ok t/Math-Int64.t .......... ok t/Math-UInt64-Native.t .. ok t/Math-UInt64.t ......... ok t/MSC.t ................. ok t/pods.t ................ skipped: Only the author needs to check that + POD docs are right All tests successful. Files=8, Tests=256, 2 wallclock secs ( 0.16 usr + 0.08 sys = 0.23 C +PU) Result: PASS C:\Documents and Settings\Owner\Desktop\cpan libs\salva-p5-Math-Int64- +09023f2>
        Also I looked up how GCC does the double to unsigned int64,
        call *__imp__DebugBreak@0 flds LC114 fldl -88(%ebp) fucom %st(1) fnstsw %ax sahf jb L193 fnstcw -26(%ebp) fsubp %st, %st(1) movzwl -26(%ebp), %eax movb $12, %ah movw %ax, -28(%ebp) fldcw -28(%ebp) fistpq -40(%ebp) fldcw -26(%ebp) movl -36(%ebp), %edx movl -40(%ebp), %eax leal -2147483648(%edx), %ecx movl %ecx, %edx jmp L146
        This is from SvU64 from " if (may_die_on_overflow && ( (nv < 0) || (nv >= NV_0x1p64)) ) overflow(aTHX_ out_of_bounds_error_u); return NV2U64(nv);" area. The DebugBreak is right before the return statement and after the overflow check.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://974383]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2014-07-26 07:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls