Hi,

I have a program I need to write using only the operators:
! ~ & ^ | + << >>
I can not use any loops.

The problem is to return 1 is x > 0 and return 0 otherwise. I can figure out the positive numbered ones, just by flipping the bits and shifting and adding one, but I don't really understand when a number is negative. How can you tell when a a byte or 32 bits is positive or negative?


Thanks,
Mary