[quake3-bugzilla] [Bug 6432] Undefined behavior

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Wed Jun 22 13:53:02 EDT 2016


https://bugzilla.icculus.org/show_bug.cgi?id=6432

--- Comment #1 from Eugene C. <mine at ukr.net> ---
Here is another jumpless macro that correctly handles overflows (i.e. always
returns 0xFFFFFFFF) for input values in range [33..63]: 
#define MASK_32BITS(shift) ( ( ( (1 << (shift)) )  & ~( (((shift) & 0xFFFFFFE0
) >> 5) << shift ) ) - 1 )
Jumpless version that correctly handles 64-bit integers but not
overflows[33..63]:
#define MASK_32BITS(shift) ( ( ( (1 << (shift)) ) & ~( ((shift) & 32) >> 5 ) )
- 1 )

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/quake3-bugzilla/attachments/20160622/5f564bf8/attachment.html>


More information about the quake3-bugzilla mailing list