# /space/home/slher/rel/Beken/v6_4_5/macsw/modules/common/src/co_math.h File Reference

Common optimized math functions. More...

`#include "co_int.h"`
`#include "co_bool.h"`
`#include "co_bit.h"`
`#include <stdlib.h>`
`#include "compiler.h"`

Go to the source code of this file.

## Defines
#define | CO_ALIGN4_HI(val) (((val)+3)&~3)
| Align val on the multiple of 4 equal or nearest higher.
#define | CO_ALIGNx_HI(val, x) (((val)+((x)-1))&~((x)-1))
| Align val on the multiple of a given number equal or nearest higher.
#define | CO_ALIGN4_LO(val) ((val)&~3)
| Align val on the multiple of 4 equal or nearest lower.
#define | CO_ALIGN2_HI(val) (((val)+1)&~1)
| Align val on the multiple of 2 equal or nearest higher.
#define | CO_ALIGN2_LO(val) ((val)&~1)
| Align val on the multiple of 2 equal or nearest lower.
## Functions
__INLINE uint32_t | co_clz (uint32_t val)
| Count leading zeros.
__INLINE void | co_random_init (uint32_t seed)
| Function to initialize the random seed.
__INLINE uint8_t | co_rand_byte (void)
| Function to get an 8 bit random number.
__INLINE uint16_t | co_rand_hword (void)
| Function to get an 16 bit random number.
__INLINE uint32_t | co_rand_word (void)
| Function to get an 32 bit random number.
__INLINE uint32_t | co_min (uint32_t a, uint32_t b)
| Function to return the smallest of 2 unsigned 32 bits words.
__INLINE uint32_t | co_max (uint32_t a, uint32_t b)
| Function to return the greatest of 2 unsigned 32 bits words.
__INLINE int | co_abs (int val)
| Function to return the absolute value of a signed integer.
uint32_t | co_crc32 (uint32_t addr, uint32_t len, uint32_t crc)
| Compute a CRC32 on the buffer passed as parameter.

## Detailed Description

Common optimized math functions.

Copyright (C) RivieraWaves 2011-2019

Definition in file co_math.h.