[Numpy-discussion] Changeset 6557

Charles R Harris charlesr.harris@gmail....
Fri Mar 6 15:53:17 CST 2009


On Fri, Mar 6, 2009 at 2:01 PM, Charles R Harris
<charlesr.harris@gmail.com>wrote:

> Hi David,
>
> Currently,
>
> bint.i = __STR2INTCST("ABCD");
>
> It is probably more portable to just initialize the union
>
>     union {
>         char c[4];
>         npy_uint32 i;
>     } bint = {'A','B','C','D'};
>
>
> If you use const union the initialization will be done at compile time.
>

Better yet

     const union {
        npy_uint32 i;
        char c[4];
    } bint = {0x01020304};

And check for the numbers 1,2,3,4.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090306/0a42aab9/attachment.html 


More information about the Numpy-discussion mailing list