lnvis

nanovg lightning network visualizer
git clone git://jb55.com/lnvis
Log | Files | Refs | README | LICENSE

defs.h (695B)


      1 
      2 #ifndef LNVIS_DEFS_H
      3 #define LNVIS_DEFS_H
      4 
      5 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
      6 
      7 #include <inttypes.h>
      8 #include <string.h>
      9 
     10 typedef unsigned char u8;
     11 typedef signed char s8;
     12 
     13 typedef unsigned short u16;
     14 typedef signed short s16;
     15 
     16 typedef unsigned int u32;
     17 typedef signed int s32;
     18 
     19 typedef uint64_t u64;
     20 typedef int64_t s64;
     21 
     22 static inline int streq(const char *a, const char *b)
     23 {
     24 	return strcmp(a, b) == 0;
     25 }
     26 
     27 #define min(a,b)				\
     28 	({ __typeof__ (a) _a = (a);		\
     29 		__typeof__ (b) _b = (b);	\
     30 		_a < _b ? _a : _b; })
     31 
     32 #define max(a,b)				\
     33 	({ __typeof__ (a) _a = (a);		\
     34 		__typeof__ (b) _b = (b);	\
     35 		_a > _b ? _a : _b; })
     36 
     37 
     38 #define nodeid_eq streq
     39 
     40 #endif /* LNVIS_DEFS_H */
     41