Re: [AD] shiftoperators (was: improvements on alphablending...)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


>> Well, my concern was something like this: how do you know that shifting to
>> the right corresponds to deviding by 2? I don't know of such machines, but
>> it would be possible that there are machines that have the low bit at the
>> *left* of a word, so that the 8 bit number 01000000 would be equal to 2
>> instead of 64?
>
>Because the C standard defines it that way.  

It does? Geez, would've been nice if my C book had told me earlier. 

[snip]

>> Also, couldn't it give incompatibel code between little endian/big endian
>> encodings?
>
>Endianness is a totally different issue, only relating to how
>multibyte quantities are stored in memory.  Shifting occurs on
>the CPU.

No, having thought a little more about it, I see that I was trapped in my
own logic. Endianess wouldn't matter. Forget I asked.

>> Anyway, I usually try to avoid shift operators if I want my code to run at
>> my PC as well as a SUN workstation. Am I over cautious?
>
>Yes.

Glad to hear it! Actually makes life a little easier ;-)

Evert



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/