This is in relation to a homework assignment but this is not the homework assignment.
I'm having difficultly understanding if there is a difference on how the bitwise not (~
in C) would affected signed int
and unsigned int
when compiled on a big endian machine vs. a little endian machine.
Are the bytes really "backwards" and if so does the bitwise not (and other operators) cause different resulting int
s be produced depending on the machine type?
While we are at it, is the answer the same for each of the bitwise operators in C or does it heavily depend?
The operators I'm referring to are:
~ /* bitwise Not */
& /* bitwise And */
| /* bitwise Or */
^ /* bitwise Exclusive-Or */
Thank you in Advance!
Regards,
Frank
Update: In reading my responses thus far, I feel compelled to ask if the bitwise not operator affects the sign bit on a signed int
. I'm afraid I've been a bit confused on this part as I forgot about all that stillyness. Adam seems to be stating that all values are treated as unsigned. Is the sign-bit reapplied or does the once signed value become unsigned?