[Numpy-discussion] Changeset 6557
David Cournapeau
cournape@gmail....
Sat Mar 7 12:57:24 CST 2009
On Sun, Mar 8, 2009 at 3:20 AM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
>
> The macro is ugly, unneeded, and obfuscating. Why construct a number from
> characters and shifts when you can just *write it down*?
The idea was to replace the 'ABCD' multi-byte constant. If you think
that writing down the corresponding integer is cleaner, so be it - I
don't care either way. I am not sure I see a difference between 'A' <<
24 .... and 103...., though.
> True, it is initialized here:
>
> movl $16909060, -8(%ebp)
>
The generated assembly is exactly the same wether the constant is
initialized through the macro or the integer (the actual integer is in
the assembly). But in the following case:
const union {
npy_uint32 i;
char c[4];
} bint = {some constant};
switch (bint.c[0]) {
case 'A':
etc....
}
The compiler did not remove the conditionals corresponding to the
switch - const or not.
cheers,
David
More information about the Numpy-discussion
mailing list