dwmblocks

Kris's build of dwmblocks
git clone git clone https://git.krisyotam.com/krisyotam/dwmblocks.git
Log | Files | Refs | README | LICENSE

util.h (719B)


      1 #ifndef UTIL_H
      2 #define UTIL_H
      3 
      4 #include <stddef.h>
      5 
      6 #define MAX(a, b) ((a) > (b) ? (a) : (b))
      7 #define LEN(arr)  (sizeof(arr) / sizeof((arr)[0]))
      8 #define BIT(n)    (1 << (n))
      9 
     10 // NOLINTBEGIN(bugprone-macro-parentheses)
     11 #define MEMBER_SIZE(type, member) sizeof(((type*)NULL)->member)
     12 #define MEMBER_LENGTH(type, member) \
     13     (MEMBER_SIZE(type, member) / MEMBER_SIZE(type, member[0]))
     14 // NOLINTEND(bugprone-macro-parentheses)
     15 
     16 #define UTF8_MAX_BYTE_COUNT 4
     17 
     18 enum pipe_fd_index {
     19     READ_END,
     20     WRITE_END,
     21     PIPE_FD_COUNT,
     22 };
     23 
     24 unsigned int gcd(unsigned int a, unsigned int b);
     25 size_t truncate_utf8_string(char* const buffer, const size_t size,
     26                             const size_t char_limit);
     27 
     28 #endif  // UTIL_H