program logic based on endianness



Hi Everyone,

I have a program unit which does >> and << of an integer which is of
4 bytes length. The logic of shifting and action based on the result,
assumes that the system is big-endian.

Accordingly, if i need the program to work fine in a little-endian
system. I understand that the code needs to be changed.

I wanted to know if the above holds true for bitwise and (&) and
bitwise or (|). I think, the processor should take care of the
operation a&b or a|b irrespective of the endianness of the system.

Please provide your comments.

Thanks in advance!!!

.



Relevant Pages

  • Re: bitwise operator and endianness
    ... The logic of shifting and action based on the result, ... assumes that the system is big-endian. ... The appropriate fix depends upon the way in which that assumption is built into the code. ... Endianness only matters if a) you're sharing data between systems with different endianness or b) you're accessing the integer as a array of unsigned char. ...
    (comp.lang.c)
  • bitwise operator and endianness
    ... assumes that the system is big-endian. ... find any statement in C90 about endianness, ... programs are not portable if the endianness of the system changes) ... I wanted to know if the above holds true for bitwise and and ...
    (comp.lang.c)
  • Re: program logic based on endianness
    ... The logic of shifting and action based on the result, ... assumes that the system is big-endian. ... I wanted to know if the above holds true for bitwise and and ... the bitwise operators -- work on the values of their ...
    (comp.unix.programmer)
  • Re: Unicode chinese
    ... bitwise and bit shifting? ... Roedy Green Canadian Mind Products ...
    (comp.lang.java.programmer)
  • Re: Display a 32bit value as a 4ch string?
    ... I understand the bit shifting and char cast, but I don't understand the bitwise & with 0xFF. ... I'm guessing it's something to do with signed/unsigned? ...
    (microsoft.public.vc.language)