Motr  M0
misc.c File Reference
#include "lib/types.h"
#include "lib/string.h"
#include "lib/time.h"
#include "lib/memory.h"
#include "lib/arith.h"
#include "ut/ut.h"
Include dependency graph for misc.c:

Go to the source code of this file.

Macros

#define BM_COMMON_STR   "bm-majority-algorithm"
 

Enumerations

enum  { BM_MJR_EVEN_ARR_LEN = 1000, BM_MJR_ODD_ARR_LEN }
 

Functions

static void uint128_add_check (const struct m0_uint128 *a, const struct m0_uint128 *b, const struct m0_uint128 *sum)
 
static void uint128_add_ut (void)
 
static void uint128_mul_check (uint64_t a, uint64_t b, const struct m0_uint128 *c)
 
static void uint128_mul_check1 (uint64_t a, uint64_t b, const struct m0_uint128 *c)
 
static void uint128_mul_ut (void)
 
static void test_forall_exists (void)
 
static void test_str_startswith (void)
 
static void test_majority_ident_arr (void)
 
static void test_majority_dist_val (void)
 
static void test_majority_tie (void)
 
static void test_majority_get (void)
 
void m0_test_misc (void)
 

Variables

static const struct m0_uint128 zero = M0_UINT128(0, 0)
 
static const struct m0_uint128 one = M0_UINT128(0, 1)
 
static const struct m0_uint128 two = M0_UINT128(0, 2)
 
static const struct m0_uint128 three = M0_UINT128(0, 3)
 
static const struct m0_uint128 cmax64 = M0_UINT128(0, UINT64_MAX)
 
static const struct m0_uint128 cmax64_1 = M0_UINT128(1, 0)
 
static const struct m0_uint128 cmax64_2 = M0_UINT128(1, 1)
 
static const struct m0_uint128 cmax128 = M0_UINT128(UINT64_MAX, UINT64_MAX)
 

Macro Definition Documentation

◆ BM_COMMON_STR

#define BM_COMMON_STR   "bm-majority-algorithm"

Definition at line 34 of file misc.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BM_MJR_EVEN_ARR_LEN 
BM_MJR_ODD_ARR_LEN 

Definition at line 36 of file misc.c.

Function Documentation

◆ m0_test_misc()

void m0_test_misc ( void  )

Definition at line 263 of file misc.c.

Here is the call graph for this function:

◆ test_forall_exists()

static void test_forall_exists ( void  )
static

Definition at line 117 of file misc.c.

Here is the caller graph for this function:

◆ test_majority_dist_val()

static void test_majority_dist_val ( void  )
static

Definition at line 182 of file misc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_majority_get()

static void test_majority_get ( void  )
static

Definition at line 256 of file misc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_majority_ident_arr()

static void test_majority_ident_arr ( void  )
static

Definition at line 140 of file misc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_majority_tie()

static void test_majority_tie ( void  )
static

Definition at line 219 of file misc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_str_startswith()

static void test_str_startswith ( void  )
static

Definition at line 128 of file misc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uint128_add_check()

static void uint128_add_check ( const struct m0_uint128 a,
const struct m0_uint128 b,
const struct m0_uint128 sum 
)
static

Definition at line 50 of file misc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uint128_add_ut()

static void uint128_add_ut ( void  )
static

Definition at line 63 of file misc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uint128_mul_check()

static void uint128_mul_check ( uint64_t  a,
uint64_t  b,
const struct m0_uint128 c 
)
static

Definition at line 80 of file misc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uint128_mul_check1()

static void uint128_mul_check1 ( uint64_t  a,
uint64_t  b,
const struct m0_uint128 c 
)
static

Definition at line 90 of file misc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uint128_mul_ut()

static void uint128_mul_ut ( void  )
static

Definition at line 98 of file misc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cmax128

const struct m0_uint128 cmax128 = M0_UINT128(UINT64_MAX, UINT64_MAX)
static

Definition at line 48 of file misc.c.

◆ cmax64

const struct m0_uint128 cmax64 = M0_UINT128(0, UINT64_MAX)
static

Definition at line 45 of file misc.c.

◆ cmax64_1

const struct m0_uint128 cmax64_1 = M0_UINT128(1, 0)
static

Definition at line 46 of file misc.c.

◆ cmax64_2

const struct m0_uint128 cmax64_2 = M0_UINT128(1, 1)
static

Definition at line 47 of file misc.c.

◆ one

const struct m0_uint128 one = M0_UINT128(0, 1)
static

Definition at line 42 of file misc.c.

◆ three

const struct m0_uint128 three = M0_UINT128(0, 3)
static

Definition at line 44 of file misc.c.

◆ two

const struct m0_uint128 two = M0_UINT128(0, 2)
static

Definition at line 43 of file misc.c.

◆ zero

const struct m0_uint128 zero = M0_UINT128(0, 0)
static

Definition at line 41 of file misc.c.