|
| bool | piojo_opaque_eq (const void *e1, const void *e2) |
| |
| bool | piojo_id_eq (const void *e1, const void *e2) |
| |
| bool | piojo_safe_adduint_p (unsigned int v1, unsigned int v2) |
| |
| bool | piojo_safe_addsiz_p (size_t v1, size_t v2) |
| |
| bool | piojo_safe_addint_p (int v1, int v2) |
| |
| bool | piojo_safe_subuint_p (unsigned int v1, unsigned int v2) |
| |
| bool | piojo_safe_subsiz_p (size_t v1, size_t v2) |
| |
| bool | piojo_safe_subint_p (int v1, int v2) |
| |
| bool | piojo_safe_muluint_p (unsigned int v1, unsigned int v2) |
| |
| bool | piojo_safe_mulsiz_p (size_t v1, size_t v2) |
| |
| size_t | piojo_maxsiz (size_t v1, size_t v2) |
| |
| unsigned int | piojo_maxuint (unsigned int v1, unsigned int v2) |
| |
| int | piojo_maxint (int v1, int v2) |
| |
| size_t | piojo_minsiz (size_t v1, size_t v2) |
| |
| unsigned int | piojo_minuint (unsigned int v1, unsigned int v2) |
| |
| int | piojo_minint (int v1, int v2) |
| |
| size_t | piojo_clampsiz (size_t val, size_t start, size_t end) |
| |
| unsigned int | piojo_clampuint (unsigned int val, unsigned int start, unsigned int end) |
| |
| int | piojo_clampint (int val, int start, int end) |
| |
Piojo useful types/functions.
| #define PIOJO_VERSION_MAJOR |
| #define PIOJO_VERSION_MINOR |
| #define PIOJO_VERSION_PATCH |
| typedef void*(* piojo_alloc_cb)(size_t size) |
Allocates size bytes of memory.
| typedef int(* piojo_cmp_cb)(const void *e1, const void *e2) |
Returns -1, 0, 1 when e1 is less than, equal to, or greater than e2.
| typedef void(* piojo_copy_cb)(const void *ptr, size_t esize, void *newptr) |
Copies esize bytes of memory pointed by ptr to newptr.
| typedef bool(* piojo_eq_cb)(const void *e1, const void *e2) |
Returns TRUE if e1 is equal to e2, FALSE otherwise.
| typedef void(* piojo_finish_cb)(void *ptr) |
Finishes memory pointed by ptr.
| typedef void(* piojo_free_cb)(const void *ptr) |
Frees memory pointed by ptr.
| typedef void(* piojo_init_cb)(const void *data, size_t esize, void *ptr) |
Initializes esize bytes of memory pointed by ptr with data.
| typedef void*(* piojo_realloc_cb)(const void *ptr, size_t size) |
Reallocates ptr to size bytes of memory.
| int piojo_clampint |
( |
int |
val, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
Returns value clamped to interval.
- Parameters
-
| [in] | val | |
| [in] | start | Interval start. |
| [in] | end | Interval end. |
- Returns
- Clamped value.
| size_t piojo_clampsiz |
( |
size_t |
val, |
|
|
size_t |
start, |
|
|
size_t |
end |
|
) |
| |
Returns value clamped to interval.
- Parameters
-
| [in] | val | |
| [in] | start | Interval start. |
| [in] | end | Interval end. |
- Returns
- Clamped value.
| unsigned int piojo_clampuint |
( |
unsigned int |
val, |
|
|
unsigned int |
start, |
|
|
unsigned int |
end |
|
) |
| |
Returns value clamped to interval.
- Parameters
-
| [in] | val | |
| [in] | start | Interval start. |
| [in] | end | Interval end. |
- Returns
- Clamped value.
| bool piojo_id_eq |
( |
const void * |
e1, |
|
|
const void * |
e2 |
|
) |
| |
Equality function for ID types.
- Parameters
-
- Returns
- TRUE if e1 is equal to e2, FALSE otherwise.
| int piojo_maxint |
( |
int |
v1, |
|
|
int |
v2 |
|
) |
| |
Returns maximum value.
- Parameters
-
- Returns
- Maximum value.
| size_t piojo_maxsiz |
( |
size_t |
v1, |
|
|
size_t |
v2 |
|
) |
| |
Returns maximum value.
- Parameters
-
- Returns
- Maximum value.
| unsigned int piojo_maxuint |
( |
unsigned int |
v1, |
|
|
unsigned int |
v2 |
|
) |
| |
Returns maximum value.
- Parameters
-
- Returns
- Maximum value.
| int piojo_minint |
( |
int |
v1, |
|
|
int |
v2 |
|
) |
| |
Returns minimum value.
- Parameters
-
- Returns
- Minimum value.
| size_t piojo_minsiz |
( |
size_t |
v1, |
|
|
size_t |
v2 |
|
) |
| |
Returns minimum value.
- Parameters
-
- Returns
- Minimum value.
| unsigned int piojo_minuint |
( |
unsigned int |
v1, |
|
|
unsigned int |
v2 |
|
) |
| |
Returns minimum value.
- Parameters
-
- Returns
- Minimum value.
| bool piojo_opaque_eq |
( |
const void * |
e1, |
|
|
const void * |
e2 |
|
) |
| |
Equality function for opaque types.
- Parameters
-
- Returns
- TRUE if e1 is equal to e2, FALSE otherwise.
| bool piojo_safe_addint_p |
( |
int |
v1, |
|
|
int |
v2 |
|
) |
| |
Checks addition overflow/wrap.
- Parameters
-
- Returns
- FALSE if overflows/wraps, TRUE otherwise.
| bool piojo_safe_addsiz_p |
( |
size_t |
v1, |
|
|
size_t |
v2 |
|
) |
| |
Checks addition overflow/wrap.
- Parameters
-
- Returns
- FALSE if overflows/wraps, TRUE otherwise.
| bool piojo_safe_adduint_p |
( |
unsigned int |
v1, |
|
|
unsigned int |
v2 |
|
) |
| |
Checks addition overflow/wrap.
- Parameters
-
- Returns
- FALSE if overflows/wraps, TRUE otherwise.
| bool piojo_safe_mulsiz_p |
( |
size_t |
v1, |
|
|
size_t |
v2 |
|
) |
| |
Checks multiplication overflow/wrap.
- Parameters
-
- Returns
- FALSE if overflows/wraps, TRUE otherwise.
| bool piojo_safe_muluint_p |
( |
unsigned int |
v1, |
|
|
unsigned int |
v2 |
|
) |
| |
Checks multiplication overflow/wrap.
- Parameters
-
- Returns
- FALSE if overflows/wraps, TRUE otherwise.
| bool piojo_safe_subint_p |
( |
int |
v1, |
|
|
int |
v2 |
|
) |
| |
Checks subtraction overflow/wrap.
- Parameters
-
- Returns
- FALSE if overflows/wraps, TRUE otherwise.
| bool piojo_safe_subsiz_p |
( |
size_t |
v1, |
|
|
size_t |
v2 |
|
) |
| |
Checks subtraction overflow/wrap.
- Parameters
-
- Returns
- FALSE if overflows/wraps, TRUE otherwise.
| bool piojo_safe_subuint_p |
( |
unsigned int |
v1, |
|
|
unsigned int |
v2 |
|
) |
| |
Checks subtraction overflow/wrap.
- Parameters
-
- Returns
- FALSE if overflows/wraps, TRUE otherwise.