On 03/05/13 02:03, Laszlo Ersek wrote:

> Alas these evaluate "low" twice, but I can't readily see a solution with
> single evaluation. For example
> 
> #define BITS32(high, low) ((UINT32)-1 << (high) ^ (UINT32)-1 << (low))
> 
> is undefined behavior for high==32 (which is valid input for the
> exclusive case).

This works though (since high >= 1):

#define BITS32(high, low) \
          (~((UINT32)-1 >> 32 - (high)) ^ (UINT32)-1 << (low))

#define BITS64(high, low) \
          (~((UINT64)-1 >> 64 - (high)) ^ (UINT32)-1 << (low))

Laszlo

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to