<commit_before>#ifndef _SYS_MIMIKER_H_
#define _SYS_MIMIKER_H_

/* Common definitions that may be used only in kernel source tree. */

#ifndef _KERNEL
#error "<sys/mimiker.h> may be used only inside kernel source tree!"
#endif

#include <limits.h>    /* UINT_MAX, LONG_MIN, ... */
#include <stdbool.h>   /* bool, true, false */
#include <stdalign.h>  /* alignof, alignas */
#include <stdatomic.h> /* atomic_{load,store,fetch_*,...} */
#include <inttypes.h>  /* PRIdN, PRIxPTR, ... */
#include <sys/param.h>
#include <sys/types.h>

#define log2(x) (__builtin_ffs(x) - 1)
#define ffs(x) (size_t)(__builtin_ffs(x))
#define clz(x) (size_t)(__builtin_clz(x))
#define ctz(x) (size_t)(__builtin_ctz(x))

#define abs(x)                                                                 \
  ({                                                                           \
    typeof(x) _x = (x);                                                        \
    (_x < 0) ? -_x : _x;                                                       \
  })

#define min(a, b)                                                              \
  ({                                                                           \
    typeof(a) _a = (a);                                                        \
    typeof(b) _b = (b);                                                        \
    _a < _b ? _a : _b;                                                         \
  })

#define max(a, b)                                                              \
  ({                                                                           \<commit_msg>Fix log2 function in <sys/mimiker.h> by using clz (#584)<commit_after>#ifndef _SYS_MIMIKER_H_
#define _SYS_MIMIKER_H_

/* Common definitions that may be used only in kernel source tree. */

#ifndef _KERNEL
#error "<sys/mimiker.h> may be used only inside kernel source tree!"
#endif

#include <limits.h>    /* UINT_MAX, LONG_MIN, ... */
#include <stdbool.h>   /* bool, true, false */
#include <stdalign.h>  /* alignof, alignas */
#include <stdatomic.h> /* atomic_{load,store,fetch_*,...} */
#include <inttypes.h>  /* PRIdN, PRIxPTR, ... */
#include <sys/param.h>
#include <sys/types.h>

#define log2(x) (CHAR_BIT * sizeof(unsigned long) - __builtin_clzl(x) - 1)
#define ffs(x) (size_t)(__builtin_ffs(x))
#define clz(x) (size_t)(__builtin_clz(x))
#define ctz(x) (size_t)(__builtin_ctz(x))

#define abs(x)                                                                 \
  ({                                                                           \
    typeof(x) _x = (x);                                                        \
    (_x < 0) ? -_x : _x;                                                       \
  })

#define min(a, b)                                                              \
  ({                                                                           \
    typeof(a) _a = (a);                                                        \
    typeof(b) _b = (b);                                                        \
    _a < _b ? _a : _b;                                                         \
  })

#define max(a, b)                                                              \
  ({                                                                           \
{'fraction_non_alphanumeric': 0.11723720084822781, 'fraction_numerical': 0.003029385034837928, 'mean_word_length': 0.8132894014277869, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 50, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4641800', 'n_tokens_mistral': 848, 'n_tokens_neox': 841, 'n_words': 191}