# New Ticket Created by  Adam Thomason 
# Please include the string:  [perl #29402]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=29402 >


The recently posted sha1 and md5 programs produce incorrect answers on amd64, at least 
in part because bitops on 64-bit values are screwy.  One particularly odd case:

_main:
        set I1, 0xffffffff
        shl I1, I1, 32
        set I2, 0xffffffff
        band I2, I2, I1
        new P1, 32
        set P1, 2
        set P1[0], I1
        set P1[1], I2
        sprintf S1, "%lx %lx\n", P1
        print S1 # prints "ffffffff00000000 ffffffff00000000"
end

Of course, ANDing ffffffff00000000 with 00000000ffffffff should be 0.  ops/bit.ops is 
implemented as $1 &= $2, which seems straightforward enough as C, pointing towards 
gcc, but the following works fine:

int main( )
{
    long I1 = 0xffffffff;
    long I2 = 0xffffffff;
    I1 <<= 32;
    I2 = I1 & I2;
    printf( "%lx %lx\n", I1, I2 ); # prints "ffffffff00000000 0"
}

I don't see any bitops tests specifically for 64-bit values... has anyone addressed 
this?

--
Adam Thomason
[EMAIL PROTECTED]

Reply via email to