1

Which ANSI C standard says something about bit wise XOR of two signed integers? I tried to read the standard, but it is vast.

XOR of two signed integers is valid as per C standard? What will happen to the sign bit of the result?

Jens
  • 69,818
  • 15
  • 125
  • 179
Lunar Mushrooms
  • 8,358
  • 18
  • 66
  • 88
  • 2
    The "duplicate" doesn't address ^ in particular nor does it cite the standard anywhere. Vote to reopen. – Lundin Apr 09 '13 at 11:54

1 Answers1

0

Bitwise operations operate on bits, that is, on the actual 1's and 0's of the data. Therefore, sign is irrelevant; the result of the operation is what you'd get from writing out the series of 1's and 0's that represents each integer and then XORing each corresponding pair of bits. (Even type information is irrelevant, as long as the operands are integers of some sort, as opposed to doubles, pointers, etc.)

Kyle Strand
  • 15,941
  • 8
  • 72
  • 167