• Popular Now

• 14
• 12
• 9
• 10
• 13

Archived

This topic is now archived and is closed to further replies.

Bitwise algebra question

This topic is 5352 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I''m trying to implement a radix sort working with single precision floatpoint values. I''ve gotten it to work, and now I''m trying to improve it sections of the code which I needed to alter from my normal radix sort to get it to handle negatives correctly. In my inner loops(biulding the histogram & the each loop for each byte position) I have the following:
// When the sign bit is set, xor with 0xFFFFFFFF (flip every bit)

// When the sign bit is unset, xor with 0x80000000 (flip the sign bit)

var
value : longword;
...
value := ...
if (value and $80000000) <> 0 then value := value xor ($FFFFFFFF)
else