libgrapheme

unicode string library
git clone git://git.suckless.org/libgrapheme
Log | Files | Refs | README | LICENSE

util.h (592B)


      1 /* See LICENSE file for copyright and license details. */
      2 #ifndef UTIL_H
      3 #define UTIL_H
      4 
      5 #include <stddef.h>
      6 #include <stdint.h>
      7 
      8 #include "../gen/types.h"
      9 #include "../grapheme.h"
     10 
     11 #define LEN(x) (sizeof(x) / sizeof(*(x)))
     12 
     13 #undef likely
     14 #undef unlikely
     15 #ifdef __has_builtin
     16 	#if __has_builtin(__builtin_expect)
     17 		#define likely(expr) __builtin_expect(!!(expr), 1)
     18 		#define unlikely(expr) __builtin_expect(!!(expr), 0)
     19 	#else
     20 		#define likely(expr) (expr)
     21 		#define unlikely(expr) (expr)
     22 	#endif
     23 #else
     24 	#define likely(expr) (expr)
     25 	#define unlikely(expr) (expr)
     26 #endif
     27 
     28 #endif /* UTIL_H */