문제

So what happens when you OR two negative numbers? Is it ever guaranteed that whenever you OR a positive with a negative, the result will be positive?

도움이 되었습니까?

해결책

Assuming two's complement:

Whenever you OR any number with a negative number the result is negative. This is because the sign bit is set in the negative number and therefor will be set in the resulting number.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top