Hirokazu Yamamoto <ocean-c...@m2.ccsnet.ne.jp> added the comment:

Sorry,my patch didn't work again... Because of this
compiler behavior. Is this ANSI standard?

#include <stdio.h>

typedef unsigned __int32 uint32;

static void
print_bits(uint32 n)
{
    int i;

    for (i = 31; i >= 0; --i)
    {
        printf("%c", (n & (1 << i)) ? '1' : '0');
    }
    printf(" : %X\n", n);
}

int main()
{
    uint32 n;

    n = 1;
    print_bits(n << 30);
    print_bits(n << 31);
    print_bits(n << 32);
    print_bits((n << 31) << 1);
}

R:\test\bitshift>a
01000000000000000000000000000000 : 40000000
10000000000000000000000000000000 : 80000000
00000000000000000000000000000001 : 1
00000000000000000000000000000000 : 0

I thought n << 32 should be 0. I hope new patch
is somehow better.

----------
Added file: http://bugs.python.org/file19121/py3k_fix_ctypes_cfields_v2.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6493>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to