X-Git-Url: https://rtime.felk.cvut.cz/gitweb/ulut.git/blobdiff_plain/974894da4ce496c75ea491327929fd81128341e8..b2534e8c42d54ab438c6b631d4e2a3c7737518e6:/ulut/ul_utdefs.h diff --git a/ulut/ul_utdefs.h b/ulut/ul_utdefs.h index 2eab33a..3cf4b27 100644 --- a/ulut/ul_utdefs.h +++ b/ulut/ul_utdefs.h @@ -34,6 +34,30 @@ extern "C" { #endif /*__GNUC__*/ #endif /*UL_CONTAINEROF*/ +#ifndef ul_cyclic_gt +#define ul_cyclic_gt(x,y) \ + ((sizeof(x)>=sizeof(long long))&&(sizeof(y)>=sizeof(long long))? \ + (long long)((long long)(x)-(long long)(y))>0: \ + (sizeof(x)>=sizeof(long))&&(sizeof(y)>=sizeof(long))? \ + (long)((long)(x)-(long)(y))>0: /* x,y casts to suppress warnings only*/ \ + (sizeof(x)>=sizeof(int))&&(sizeof(y)>=sizeof(int))?(int)((x)-(y))>0: \ + (sizeof(x)>=sizeof(short))&&(sizeof(y)>=sizeof(short))?(short)((x)-(y))>0: \ + (signed char)((x)-(y))>0 \ + ) +#endif /*ul_cyclic_gt*/ + +#ifndef ul_cyclic_ge +#define ul_cyclic_ge(x,y) \ + ((sizeof(x)>=sizeof(long long))&&(sizeof(y)>=sizeof(long long))? \ + (long long)((long long)(x)-(long long)(y))>=0: \ + (sizeof(x)>=sizeof(long))&&(sizeof(y)>=sizeof(long))? \ + (long)((long)(x)-(long)(y))>=0: /* x,y casts to suppress warnings only*/ \ + (sizeof(x)>=sizeof(int))&&(sizeof(y)>=sizeof(int))?(int)((x)-(y))>=0: \ + (sizeof(x)>=sizeof(short))&&(sizeof(y)>=sizeof(short))?(short)((x)-(y))>=0: \ + (signed char)((x)-(y))>=0 \ + ) +#endif /*ul_cyclic_ge*/ + /* GNUC neat features */ #ifdef __GNUC__