Functions for filling buffers with various patterns of data.
More...
|
| CHECKASM_API void | checkasm_randomize (void *buf, size_t bytes) |
| | Fill a buffer with uniformly chosen random bytes. More...
|
| |
| CHECKASM_API void | checkasm_randomize_mask8 (uint8_t *buf, int width, uint8_t mask) |
| | Fill a uint8_t buffer with random values chosen uniformly within a mask. More...
|
| |
| CHECKASM_API void | checkasm_randomize_mask16 (uint16_t *buf, int width, uint16_t mask) |
| | Fill a uint16_t buffer with random values chosen uniformly within a mask. More...
|
| |
| CHECKASM_API void | checkasm_randomize_range (double *buf, int width, double range) |
| | Fill a double buffer with random values chosen uniformly below a limit. More...
|
| |
| CHECKASM_API void | checkasm_randomize_rangef (float *buf, int width, float range) |
| | Fill a float buffer with random values chosen uniformly below a limit. More...
|
| |
| CHECKASM_API void | checkasm_randomize_dist (double *buf, int width, CheckasmDist dist) |
| | Fill a double buffer with normally distributed random values. More...
|
| |
| CHECKASM_API void | checkasm_randomize_distf (float *buf, int width, CheckasmDist dist) |
| | Fill a float buffer with normally distributed random values. More...
|
| |
| CHECKASM_API void | checkasm_randomize_norm (double *buf, int width) |
| | Fill a double buffer with values from a standard normal distribution. More...
|
| |
| CHECKASM_API void | checkasm_randomize_normf (float *buf, int width) |
| | Fill a float buffer with values from a standard normal distribution. More...
|
| |
| CHECKASM_API void | checkasm_clear (void *buf, size_t bytes) |
| | Clear a buffer to a pre-determined pattern (currently 0xAA) More...
|
| |
| CHECKASM_API void | checkasm_clear8 (uint8_t *buf, int width, uint8_t val) |
| | Fill a uint8_t buffer with a constant value. More...
|
| |
| CHECKASM_API void | checkasm_clear16 (uint16_t *buf, int width, uint16_t val) |
| | Fill a uint16_t buffer with a constant value. More...
|
| |
| CHECKASM_API void | checkasm_init (void *buf, size_t bytes) |
| | Initialize a buffer with pathological test patterns. More...
|
| |
| CHECKASM_API void | checkasm_init_mask8 (uint8_t *buf, int width, uint8_t mask) |
| | Initialize a uint8_t buffer with pathological values within a mask. More...
|
| |
| CHECKASM_API void | checkasm_init_mask16 (uint16_t *buf, int width, uint16_t mask) |
| | Initialize a uint16_t buffer with pathological values within a mask. More...
|
| |
Functions for filling buffers with various patterns of data.
A collection of functions to initialize memory buffers with random data, constant values, or pathological test patterns. These are useful for setting up input/output data buffers for checkasm tests.
◆ CLEAR_BUF
Clear a fixed size buffer (convenience macro)
- Parameters
-
| buf | Fixed-size buffer array to clear |
Definition at line 254 of file utils.h.
◆ RANDOMIZE_BUF
Fill a fixed size buffer with random data (convenience macro)
- Parameters
-
| buf | Fixed-size buffer array to randomize |
Definition at line 261 of file utils.h.
◆ INITIALIZE_BUF
Fill a fixed size buffer with pathological test data (convenience macro)
- Parameters
-
| buf | Fixed-size buffer array to initialize |
- See also
- checkasm_init()
Definition at line 269 of file utils.h.
◆ checkasm_randomize()
| CHECKASM_API void checkasm_randomize |
( |
void * |
buf, |
|
|
size_t |
bytes |
|
) |
| |
Fill a buffer with uniformly chosen random bytes.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | bytes | Number of bytes to randomize |
Definition at line 201 of file utils.c.
◆ checkasm_randomize_mask8()
| CHECKASM_API void checkasm_randomize_mask8 |
( |
uint8_t * |
buf, |
|
|
int |
width, |
|
|
uint8_t |
mask |
|
) |
| |
Fill a uint8_t buffer with random values chosen uniformly within a mask.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | width | Number of elements to randomize |
| [in] | mask | Bit mask to apply to each random value |
Definition at line 208 of file utils.c.
◆ checkasm_randomize_mask16()
| CHECKASM_API void checkasm_randomize_mask16 |
( |
uint16_t * |
buf, |
|
|
int |
width, |
|
|
uint16_t |
mask |
|
) |
| |
Fill a uint16_t buffer with random values chosen uniformly within a mask.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | width | Number of elements to randomize |
| [in] | mask | Bit mask to apply to each random value |
Definition at line 214 of file utils.c.
◆ checkasm_randomize_range()
Fill a double buffer with random values chosen uniformly below a limit.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | width | Number of elements to randomize |
| [in] | range | Exclusive upper bound on value (range is [0, range)) |
Definition at line 220 of file utils.c.
◆ checkasm_randomize_rangef()
Fill a float buffer with random values chosen uniformly below a limit.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | width | Number of elements to randomize |
| [in] | range | Exclusive upper bound on value (range is [0, range)) |
Definition at line 226 of file utils.c.
◆ checkasm_randomize_dist()
Fill a double buffer with normally distributed random values.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | width | Number of elements to randomize |
| [in] | dist | Distribution parameters (mean and standard deviation) |
Definition at line 247 of file utils.c.
◆ checkasm_randomize_distf()
Fill a float buffer with normally distributed random values.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | width | Number of elements to randomize |
| [in] | dist | Distribution parameters (mean and standard deviation) |
Definition at line 252 of file utils.c.
◆ checkasm_randomize_norm()
Fill a double buffer with values from a standard normal distribution.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | width | Number of elements to randomize |
Definition at line 257 of file utils.c.
◆ checkasm_randomize_normf()
Fill a float buffer with values from a standard normal distribution.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | width | Number of elements to randomize |
Definition at line 262 of file utils.c.
◆ checkasm_clear()
| CHECKASM_API void checkasm_clear |
( |
void * |
buf, |
|
|
size_t |
bytes |
|
) |
| |
Clear a buffer to a pre-determined pattern (currently 0xAA)
- Parameters
-
| [out] | buf | Buffer to clear |
| [in] | bytes | Number of bytes to clear |
Definition at line 267 of file utils.c.
◆ checkasm_clear8()
| CHECKASM_API void checkasm_clear8 |
( |
uint8_t * |
buf, |
|
|
int |
width, |
|
|
uint8_t |
val |
|
) |
| |
Fill a uint8_t buffer with a constant value.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | width | Number of elements to set |
| [in] | val | Value to write to each element |
- Note
- This is functionally equivalent to memset(), and merely provided for consistency.
Definition at line 272 of file utils.c.
◆ checkasm_clear16()
| CHECKASM_API void checkasm_clear16 |
( |
uint16_t * |
buf, |
|
|
int |
width, |
|
|
uint16_t |
val |
|
) |
| |
Fill a uint16_t buffer with a constant value.
- Parameters
-
| [out] | buf | Buffer to fill |
| [in] | width | Number of elements to set |
| [in] | val | Value to write to each element |
Definition at line 277 of file utils.c.
◆ checkasm_init()
| CHECKASM_API void checkasm_init |
( |
void * |
buf, |
|
|
size_t |
bytes |
|
) |
| |
Initialize a buffer with pathological test patterns.
Fills a buffer with a random mixture of edge cases, test patterns, and random data designed to trigger potential bugs. The exact pattern depends on the random seed and may include a mix of low values, high values, alternating bits, random bytes, and so on.
- Parameters
-
| [out] | buf | Buffer to initialize |
| [in] | bytes | Number of bytes to initialize |
Definition at line 326 of file utils.c.
◆ checkasm_init_mask8()
| CHECKASM_API void checkasm_init_mask8 |
( |
uint8_t * |
buf, |
|
|
int |
width, |
|
|
uint8_t |
mask |
|
) |
| |
Initialize a uint8_t buffer with pathological values within a mask.
- Parameters
-
| [out] | buf | Buffer to initialize |
| [in] | width | Number of elements to initialize |
| [in] | mask | Bit mask to apply to values |
- See also
- checkasm_init()
Referenced by checkasm_init().
◆ checkasm_init_mask16()
| CHECKASM_API void checkasm_init_mask16 |
( |
uint16_t * |
buf, |
|
|
int |
width, |
|
|
uint16_t |
mask |
|
) |
| |
Initialize a uint16_t buffer with pathological values within a mask.
- Parameters
-
| [out] | buf | Buffer to initialize |
| [in] | width | Number of elements to initialize |
| [in] | mask | Bit mask to apply to values |
- See also
- checkasm_init()