This is something really easy but my brain is struggling today. I have a long which has a value of 10. I want to convert it to negative (i.e. -10)
I am using
lValue = lValue - (lValue * 2);
There has to be a simpler bit swapping way of doing it.
This is something really easy but my brain is struggling today. I have a long which has a value of 10. I want to convert it to negative (i.e. -10)
I am using
lValue = lValue - (lValue * 2);
There has to be a simpler bit swapping way of doing it.
Yeah, like:
Code:lValue = -lValue;
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
See, I said my brain had given up for the day.