]> rtime.felk.cvut.cz Git - ulut.git/blobdiff - ulut/ul_utdefs.h
uLUt library updated from other projects.
[ulut.git] / ulut / ul_utdefs.h
index 2eab33ab7799247e321306f245496298e8a34323..3cf4b27d0c8a9b275450425b42cede361543295a 100644 (file)
@@ -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__