55 if (rc < 2 || u128->
u_hi == LLONG_MAX || u128->
u_lo == LLONG_MAX)
59 return rc == 2 ? 0 : -EINVAL;
70 uint64_t a_lo = a->
u_lo;
80 uint64_t a_hi = a >> 32;
82 uint64_t b_hi = b >> 32;
107 return *prev = *prev * 6364136223846793005ULL + 1442695040888963407ULL;
119 result = *prev = *prev * 0x5DEECE66DULL + 0xB;
124 return (result >> 16) *
max / ((~0UL) >> 16);
140 static uint64_t
m0u64(
const unsigned char *
s)
145 for (v = 0,
i = 0;
i < 8; ++
i)
146 v |= ((uint64_t)
s[
i]) << (64 - 8 -
i * 8);
165 delta = (int64_t)x0 - (int64_t)x1;
209 return b ?
"true" :
"false";
214 static const char top_src_dir[] =
"motr/";
217 p = strstr(fname, top_src_dir);
219 return p + strlen(top_src_dir);
230 static const uint8_t bits_set[] = {
261 array + j * elem_size,
265 M0_INTERNAL
unsigned int 268 unsigned long hash = 0;
272 hash = (hash + (c << 4) + (c >> 4)) * 11;
274 return ((
unsigned int)hash);
288 M0_INTERNAL
void m0_permute(uint64_t
n, uint64_t *k, uint64_t *
s, uint64_t *
r)
309 for (
i = 0;
i <
n - 1; ++
i) {
313 for (j =
t; j >
i; --j)
331 for (
i = 0;
i < arr_len - 1; ++
i) {
332 for (j =
i + 1; j < arr_len - 1; ++j) {
343 char byte_val = *((
char*)
buffer + byte_num);
346 return 0x1 & (byte_val >> bit_shift);
353 char *byte_val = (
char*)
buffer + byte_num;
355 *byte_val |= (0x1 &
val) << bit_shift;
393 for (
i = 0,
count = 0;
i < len; ++
i) {
415 for (
i = 0,
count = 0;
i < len; ++
i) {
M0_INTERNAL int m0_uint128_cmp(const struct m0_uint128 *u0, const struct m0_uint128 *u1)
M0_INTERNAL void m0_key_val_null_set(struct m0_key_val *kv)
static struct m0_addb2_philter p
static struct m0_semaphore q
M0_INTERNAL bool m0_bit_get(void *buffer, m0_bcount_t i)
M0_INTERNAL bool m0_buf_eq(const struct m0_buf *x, const struct m0_buf *y)
M0_INTERNAL bool m0_uint128_eq(const struct m0_uint128 *u0, const struct m0_uint128 *u1)
static int64_t getdelta(uint64_t x0, uint64_t x1)
static uint64_t m0u64(const unsigned char *s)
M0_INTERNAL void m0_uint128_init(struct m0_uint128 *u128, const char *magic)
static bool m0_is_po2(uint64_t val)
M0_INTERNAL const char * m0_failed_condition
static void m0_rc_hook(int rc)
static uint64_t magic(const struct m0_tl_descr *d, const void *obj)
M0_INTERNAL void m0_permute(uint64_t n, uint64_t *k, uint64_t *s, uint64_t *r)
M0_INTERNAL bool m0_mod_ge(uint64_t x0, uint64_t x1)
M0_INTERNAL bool m0_elems_are_unique(const void *array, unsigned nr_elems, size_t elem_size)
M0_INTERNAL const struct m0_key_val M0_KEY_VAL_NULL
M0_INTERNAL uint64_t m0_round_up(uint64_t val, uint64_t size)
M0_INTERNAL const char * m0_short_file_name(const char *fname)
M0_INTERNAL uint64_t m0_round_down(uint64_t val, uint64_t size)
M0_INTERNAL uint64_t m0_dummy_id_generate(void)
#define M0_BYTES(bits_nr)
uint64_t m0_rnd(uint64_t max, uint64_t *prev)
M0_INTERNAL const char * m0_bool_to_str(bool b)
static struct m0_addb2_callback c
M0_INTERNAL void m0_key_val_init(struct m0_key_val *kv, const struct m0_buf *key, const struct m0_buf *val)
static struct m0_thread t[8]
static long long max(long long a, long long b)
M0_INTERNAL const void * m0_ptr_unwrap(uint64_t val)
M0_INTERNAL uint32_t m0_no_of_bits_set(uint64_t val)
static int cmp(const struct m0_ut_suite **s0, const struct m0_ut_suite **s1)
M0_INTERNAL uint64_t m0_gcd64(uint64_t p, uint64_t q)
#define m0_forall(var, nr,...)
M0_INTERNAL bool m0_mod_gt(uint64_t x0, uint64_t x1)
uint64_t m0_rnd64(uint64_t *prev)
M0_INTERNAL void m0_uint128_mul64(struct m0_uint128 *res, uint64_t a, uint64_t b)
M0_INTERNAL int m0_uint128_sscanf(const char *s, struct m0_uint128 *u128)
M0_INTERNAL void m0_bit_set(void *buffer, m0_bcount_t i, bool val)
M0_INTERNAL uint64_t m0_ptr_wrap(const void *p)
#define M0_UINT128(hi, lo)
static void m0_err_hook(int rc)
M0_BASSERT(sizeof(struct m0_uint128)==16)
void __dummy_function(void)
M0_INTERNAL void m0_array_sort(uint64_t *arr, uint64_t arr_len)
M0_INTERNAL void * m0_vote_majority_get(struct m0_key_val *arr, uint32_t len, bool(*cmp)(const struct m0_buf *, const struct m0_buf *), uint32_t *vote_nr)
static struct m0_addb2_source * s
M0_INTERNAL unsigned int m0_full_name_hash(const unsigned char *name, unsigned int len)
M0_INTERNAL bool m0_key_val_is_null(struct m0_key_val *kv)
M0_INTERNAL void m0_uint128_add(struct m0_uint128 *res, const struct m0_uint128 *a, const struct m0_uint128 *b)
static int64_t m0_atomic64_add_return(struct m0_atomic64 *a, int64_t d)