diff -r 92e482410453 -r d345541018fa docs/api-2.1/ucx_8h.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/api-2.1/ucx_8h.html Sat Feb 06 19:11:44 2021 +0100 @@ -0,0 +1,388 @@ + + + + + + + +ucx: /home/mike/workspace/c/ucx/src/ucx/ucx.h File Reference + + + + + + + + + +
+
+ + + + + + + +
+
ucx +
+
UAP Common Extensions
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+Macros | +Typedefs | +Functions
+
+
ucx.h File Reference
+
+
+ +

Main UCX Header providing most common definitions. +More...

+
#include <stdlib.h>
+#include <stdint.h>
+#include <sys/types.h>
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + +

+Macros

#define UCX_VERSION_MAJOR   2
 Major UCX version as integer constant. More...
 
#define UCX_VERSION_MINOR   1
 Minor UCX version as integer constant. More...
 
#define UCX_VERSION   (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR)
 Version constant which ensures to increase monotonically. More...
 
#define ucx_szmul(a, b, result)   ucx_szmul_impl(a, b, result)
 Performs a multiplication of size_t values and checks for overflow. More...
 
+ + + + + + + + + + + + + + + + + + + +

+Typedefs

typedef void(* ucx_destructor) (void *)
 A function pointer to a destructor function. More...
 
typedef int(* cmp_func) (const void *, const void *, void *)
 Function pointer to a compare function. More...
 
typedef intmax_t(* distance_func) (const void *, const void *, void *)
 Function pointer to a distance function. More...
 
typedef void *(* copy_func) (const void *, void *)
 Function pointer to a copy function. More...
 
typedef size_t(* write_func) (const void *, size_t, size_t, void *)
 Function pointer to a write function. More...
 
typedef size_t(* read_func) (void *, size_t, size_t, void *)
 Function pointer to a read function. More...
 
+ + + + +

+Functions

int ucx_szmul_impl (size_t a, size_t b, size_t *result)
 Performs a multiplication of size_t values and checks for overflow. More...
 
+

Detailed Description

+

Main UCX Header providing most common definitions.

+
Author
Mike Becker
+
+Olaf Wintermann
+

Macro Definition Documentation

+ +

◆ ucx_szmul

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define ucx_szmul( a,
 b,
 result 
)   ucx_szmul_impl(a, b, result)
+
+ +

Performs a multiplication of size_t values and checks for overflow.

+
Parameters
+ + + + +
afirst operand
bsecond operand
resulta pointer to a size_t, where the result should be stored
+
+
+
Returns
zero, if no overflow occurred and the result is correct, non-zero otherwise
+ +
+
+ +

◆ UCX_VERSION

+ +
+
+ + + + +
#define UCX_VERSION   (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR)
+
+ +

Version constant which ensures to increase monotonically.

+ +
+
+ +

◆ UCX_VERSION_MAJOR

+ +
+
+ + + + +
#define UCX_VERSION_MAJOR   2
+
+ +

Major UCX version as integer constant.

+ +
+
+ +

◆ UCX_VERSION_MINOR

+ +
+
+ + + + +
#define UCX_VERSION_MINOR   1
+
+ +

Minor UCX version as integer constant.

+ +
+
+

Typedef Documentation

+ +

◆ cmp_func

+ +
+
+ + + + +
typedef int(* cmp_func) (const void *, const void *, void *)
+
+ +

Function pointer to a compare function.

+

The compare function shall take three arguments: the two values that shall be compared and optional additional data. The function shall then return -1 if the first argument is less than the second argument, 1 if the first argument is greater than the second argument and 0 if both arguments are equal. If the third argument is NULL, it shall be ignored.

+ +
+
+ +

◆ copy_func

+ +
+
+ + + + +
typedef void*(* copy_func) (const void *, void *)
+
+ +

Function pointer to a copy function.

+

The copy function shall create a copy of the first argument and may use additional data provided by the second argument. If the second argument is NULL, it shall be ignored.

+

Attention: if pointers returned by functions of this type may be passed to free() depends on the implementation of the respective copy_func.

+ +
+
+ +

◆ distance_func

+ +
+
+ + + + +
typedef intmax_t(* distance_func) (const void *, const void *, void *)
+
+ +

Function pointer to a distance function.

+

The distance function shall take three arguments: the two values for which the distance shall be computed and optional additional data. The function shall then return the signed distance as integer value.

+ +
+
+ +

◆ read_func

+ +
+
+ + + + +
typedef size_t(* read_func) (void *, size_t, size_t, void *)
+
+ +

Function pointer to a read function.

+

The signature of the read function shall be compatible to the signature of standard fread, though it may use arbitrary data types for source and destination.

+

The arguments shall contain (in ascending order): a pointer to the destination, the length of one element, the element count and a pointer to the source.

+ +
+
+ +

◆ ucx_destructor

+ +
+
+ + + + +
typedef void(* ucx_destructor) (void *)
+
+ +

A function pointer to a destructor function.

+
See also
ucx_mempool_setdestr()
+
+ucx_mempool_regdestr()
+ +
+
+ +

◆ write_func

+ +
+
+ + + + +
typedef size_t(* write_func) (const void *, size_t, size_t, void *)
+
+ +

Function pointer to a write function.

+

The signature of the write function shall be compatible to the signature of standard fwrite, though it may use arbitrary data types for source and destination.

+

The arguments shall contain (in ascending order): a pointer to the source, the length of one element, the element count and a pointer to the destination.

+ +
+
+

Function Documentation

+ +

◆ ucx_szmul_impl()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
int ucx_szmul_impl (size_t a,
size_t b,
size_t * result 
)
+
+ +

Performs a multiplication of size_t values and checks for overflow.

+

This is a custom implementation in case there is no compiler builtin available.

+
Parameters
+ + + + +
afirst operand
bsecond operand
resulta pointer to a size_t where the result should be stored
+
+
+
Returns
zero, if no overflow occurred and the result is correct, non-zero otherwise
+ +
+
+
+ + + +