2 Answered Questions for the topic bit manipulation

Bit Manipulation C Logic


Determine the sign of a 32 bit int?

Using ONLY: ! ~ & ^ | + << >> NO LOOPS I need to determine the sign of a 32 bit integer and I need to return 1 if positive, 0 if 0 and -1 if negative. Any ideas? I first... more
Bit Manipulation Java Logic Optimization


Fastest way to get sign in Java?

I'd like to get the sign of a `float` value as an `int` value of -1 or 1. Avoiding conditionals is always a good idea in reducing computational cost. For instance, one way I can think of would be... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.