Safer NSEC_TO_U?SEC
PATCH 1/1 Safer NSEC_TO_U?SEC
Hi,
The NSEC_TO_USEC and NSEC_TO_SEC macros are not expression-safe, here is a patch that adds parenthesis for fewer surprises...
Samuel
extras/mini-os/include/time.h +2 -2
@@ -37,8 +37,8 @@ typedef s64 s_time_t;#define MICROSECS (_us) (((s_time_t)(_us)) * 1000UL )#define Time_Max ((s_time_t) 0x7fffffffffffffffLL)#define FOREVER Time_Max -#define NSEC_TO_USEC (_nsec) (_nsec / 1000UL) -#define NSEC_TO_SEC (_nsec) (_nsec / 1000000000ULL) +#define NSEC_TO_USEC (_nsec) ((_nsec) / 1000UL) +#define NSEC_TO_SEC (_nsec) ((_nsec) / 1000000000ULL)/* wall clock time */ typedef long time_t ;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel