diff options
Diffstat (limited to 'include/bh')
| -rwxr-xr-x | include/bh/algo.h | 50 | ||||
| -rw-r--r-- | include/bh/common.h | 5 | ||||
| -rwxr-xr-x | include/bh/hashmap.h | 58 | ||||
| -rw-r--r-- | include/bh/io.h | 69 | ||||
| -rw-r--r-- | include/bh/math.h | 2089 | ||||
| -rwxr-xr-x | include/bh/queue.h | 34 |
6 files changed, 907 insertions, 1398 deletions
diff --git a/include/bh/algo.h b/include/bh/algo.h index f549f1a..5d9bb36 100755 --- a/include/bh/algo.h +++ b/include/bh/algo.h @@ -12,7 +12,7 @@ * \param src Pointer to the element * \param size Element size in bytes */ -void bh_swap(void *dest, +void BH_Swap(void *dest, void *src, size_t size); @@ -30,11 +30,11 @@ void bh_swap(void *dest, * * \return Pointer to the first element of the second partition. */ -void *bh_partition(void *pivot, +void *BH_Partition(void *pivot, void *array, size_t size, size_t element, - bh_equal_cb_t equal); + BH_EqualCallback equal); /** @@ -45,10 +45,10 @@ void *bh_partition(void *pivot, * \param element Element size in bytes * \param equal Comparision function */ -void bh_sort(void *array, +void BH_Sort(void *array, size_t size, size_t element, - bh_equal_cb_t equal); + BH_EqualCallback equal); /** @@ -59,10 +59,10 @@ void bh_sort(void *array, * \param element Element size in bytes * \param equal Comparision function */ -void bh_heap_make(void *array, - size_t size, - size_t element, - bh_equal_cb_t equal); +void BH_HeapMake(void *array, + size_t size, + size_t element, + BH_EqualCallback equal); /** @@ -73,10 +73,10 @@ void bh_heap_make(void *array, * \param element Element size in bytes * \param equal Comparasion function */ -void bh_heap_remove(void *array, - size_t size, - size_t element, - bh_equal_cb_t equal); +void BH_HeapRemove(void *array, + size_t size, + size_t element, + BH_EqualCallback equal); /** @@ -91,11 +91,11 @@ void bh_heap_remove(void *array, * \param element Element size in bytes * \param equal Comparasion function */ -void bh_heap_insert(void *value, - void *array, - size_t size, - size_t element, - bh_equal_cb_t equal); +void BH_HeapInsert(void *value, + void *array, + size_t size, + size_t element, + BH_EqualCallback equal); /** @@ -106,8 +106,8 @@ void bh_heap_insert(void *value, * * This function is roughly equivalent to the following code: * \code - * bh_heap_remove(array, size, element, equal); - * bh_heap_insert(value, array, size - 1, element, equal); + * BH_HeapRemove(array, size, element, equal); + * BH_HeapInsert(value, array, size - 1, element, equal); * \endcode * * \param value Pointer to the value @@ -116,11 +116,11 @@ void bh_heap_insert(void *value, * \param element Element size in bytes * \param equal Comparasion function */ -void bh_heap_replace(void *value, - void *array, - size_t size, - size_t element, - bh_equal_cb_t equal); +void BH_HeapReplace(void *value, + void *array, + size_t size, + size_t element, + BH_EqualCallback equal); #endif /* BH_ALGO_H */ diff --git a/include/bh/common.h b/include/bh/common.h index 6f4ac88..d4aadbe 100644 --- a/include/bh/common.h +++ b/include/bh/common.h @@ -17,8 +17,9 @@ #define BH_PTR2INT(x) ((intptr_t)(x)) #define BH_INT2PTR(x) ((void*)(x)) -typedef int (*bh_equal_cb_t)(const void *, const void *); -typedef size_t (*bh_hash_cb_t)(const void *); + +typedef int (*BH_EqualCallback)(const void *, const void *); +typedef size_t (*BH_HashCallback)(const void *); #endif /* BH_COMMON_H */ diff --git a/include/bh/hashmap.h b/include/bh/hashmap.h index da89609..d3710e4 100755 --- a/include/bh/hashmap.h +++ b/include/bh/hashmap.h @@ -5,7 +5,7 @@ #include "common.h" -typedef struct bh_hashmap_s bh_hashmap_t; +typedef struct BH_Hashmap BH_Hashmap; /** @@ -17,8 +17,8 @@ typedef struct bh_hashmap_s bh_hashmap_t; * \return On success, returns hashmap handle. * \return On failure, returns a null pointer. */ -bh_hashmap_t *bh_hashmap_new(bh_equal_cb_t equal, - bh_hash_cb_t hash); +BH_Hashmap *BH_HashmapNew(BH_EqualCallback equal, + BH_HashCallback hash); /** @@ -26,7 +26,7 @@ bh_hashmap_t *bh_hashmap_new(bh_equal_cb_t equal, * * \param hashmap Hashmap handle */ -void bh_hashmap_free(bh_hashmap_t *hashmap); +void BH_HashmapFree(BH_Hashmap *hashmap); /** @@ -34,7 +34,7 @@ void bh_hashmap_free(bh_hashmap_t *hashmap); * * \param hashmap Hashmap handle */ -void bh_hashmap_clear(bh_hashmap_t *hashmap); +void BH_HashmapClear(BH_Hashmap *hashmap); /** @@ -52,8 +52,8 @@ void bh_hashmap_clear(bh_hashmap_t *hashmap); * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_hashmap_reserve(bh_hashmap_t *hashmap, - size_t size); +int BH_HashmapReserve(BH_Hashmap *hashmap, + size_t size); /** @@ -69,9 +69,9 @@ int bh_hashmap_reserve(bh_hashmap_t *hashmap, * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_hashmap_insert(bh_hashmap_t *hashmap, - void *key, - void *value); +int BH_HashmapInsert(BH_Hashmap *hashmap, + void *key, + void *value); /** @@ -84,8 +84,8 @@ int bh_hashmap_insert(bh_hashmap_t *hashmap, * \note If hashmap contains several elements with the same key, this function * will remove only one key-value pair. */ -void bh_hashmap_remove(bh_hashmap_t *hashmap, - void *key); +void BH_HashmapRemove(BH_Hashmap *hashmap, + void *key); /** @@ -98,9 +98,9 @@ void bh_hashmap_remove(bh_hashmap_t *hashmap, * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_hashmap_at(bh_hashmap_t *hashmap, - void *key, - void **value); +int BH_HashmapAt(BH_Hashmap *hashmap, + void *key, + void **value); /** @@ -111,7 +111,7 @@ int bh_hashmap_at(bh_hashmap_t *hashmap, * \return If hashmap is empty, returns non-zero value * \return If hashmap is not empty, returns zero value */ -int bh_hashmap_empty(bh_hashmap_t *hashmap); +int BH_HashmapEmpty(BH_Hashmap *hashmap); /** @@ -121,7 +121,7 @@ int bh_hashmap_empty(bh_hashmap_t *hashmap); * * \return Returns the size of the hashmap. */ -size_t bh_hashmap_size(bh_hashmap_t *hashmap); +size_t BH_HashmapSize(BH_Hashmap *hashmap); /** @@ -131,7 +131,7 @@ size_t bh_hashmap_size(bh_hashmap_t *hashmap); * * \return Returns the capacity of the hashmap. */ -size_t bh_hashmap_capacity(bh_hashmap_t *hashmap); +size_t BH_HashmapCapacity(BH_Hashmap *hashmap); /** @@ -141,7 +141,7 @@ size_t bh_hashmap_capacity(bh_hashmap_t *hashmap); * * \return Returns the load factor of the hashmap. */ -float bh_hashmap_factor(bh_hashmap_t *hashmap); +float BH_HashmapFactor(BH_Hashmap *hashmap); /** @@ -152,8 +152,8 @@ float bh_hashmap_factor(bh_hashmap_t *hashmap); * * \note New load factor will be applied on the next reserve/insert operation. */ -void bh_hashmap_set_factor(bh_hashmap_t *hashmap, - float factor); +void BH_HashmapSetFactor(BH_Hashmap *hashmap, + float factor); /** @@ -168,8 +168,8 @@ void bh_hashmap_set_factor(bh_hashmap_t *hashmap, * \note If hashmap contains several elements with the same key, this function * will return iterator to one of them */ -void *bh_hashmap_iter_at(bh_hashmap_t *hashmap, - void *key); +void *BH_HashmapIterAt(BH_Hashmap *hashmap, + void *key); /** @@ -184,8 +184,8 @@ void *bh_hashmap_iter_at(bh_hashmap_t *hashmap, * \return On success, returns new iterator value for the next element. * \return On failure, returns NULL pointer. */ -void *bh_hashmap_iter_next(bh_hashmap_t *hashmap, - void *iter); +void *BH_HashmapIterNext(BH_Hashmap *hashmap, + void *iter); /** @@ -196,8 +196,8 @@ void *bh_hashmap_iter_next(bh_hashmap_t *hashmap, * * \note Calling this function will invalidate iterators. */ -void bh_hashmap_iter_remove(bh_hashmap_t *hashmap, - void *iter); +void BH_HashmapIterRemove(BH_Hashmap *hashmap, + void *iter); /** @@ -207,7 +207,7 @@ void bh_hashmap_iter_remove(bh_hashmap_t *hashmap, * * \return Returns key. */ -void *bh_hashmap_iter_key(void *iter); +void *BH_HashmapIterKey(void *iter); /** @@ -217,7 +217,7 @@ void *bh_hashmap_iter_key(void *iter); * * \return Returns value. */ -void *bh_hashmap_iter_value(void *iter); +void *BH_HashmapIterValue(void *iter); #endif /* BH_HASHMAP_H */ diff --git a/include/bh/io.h b/include/bh/io.h index 1d964bf..ee2da95 100644 --- a/include/bh/io.h +++ b/include/bh/io.h @@ -40,10 +40,11 @@ #define BH_IO_FLAG_EOF 0x0002 #define BH_IO_FLAG_OPEN 0x0004 -#define BH_FILE_CLASSNAME "bh_file" +#define BH_FILE_CLASSNAME "BH_File" -typedef struct bh_io_s bh_io_t; -typedef int (*bh_io_func_t)(void *, int, void *, void *); + +typedef struct BH_IO BH_IO; +typedef int (*BH_IOCallback)(void *, int ,void *, void *); /** @@ -54,7 +55,7 @@ typedef int (*bh_io_func_t)(void *, int, void *, void *); * \return On success, returns IO handle. * \return On failure, returns NULL pointer. */ -bh_io_t *bh_file_new(const char *path); +BH_IO *BH_FileNew(const char *path); /** @@ -65,7 +66,7 @@ bh_io_t *bh_file_new(const char *path); * \return On success, returns IO handle. * \return On failure, returns NULL pointer. */ -bh_io_t *bh_buffer_new(bh_io_t *io); +BH_IO *BH_BufferNew(BH_IO *io); /** @@ -77,8 +78,8 @@ bh_io_t *bh_buffer_new(bh_io_t *io); * \return On success, returns IO handle. * \return On failure, returns NULL pointer. */ -bh_io_t *bh_io_new(bh_io_func_t func, - void *data); +BH_IO *BH_IONew(BH_IOCallback cb, + void *data); /** @@ -86,7 +87,7 @@ bh_io_t *bh_io_new(bh_io_func_t func, * * \param io IO handle */ -void bh_io_free(bh_io_t *io); +void BH_IOFree(BH_IO *io); /** @@ -97,7 +98,7 @@ void bh_io_free(bh_io_t *io); * \return On success, returns pointer to constant string. * \return On failure, returns NULL pointer */ -const char *bh_io_classname(bh_io_t *io); +const char *BH_IOClassname(BH_IO* io); /** @@ -109,8 +110,8 @@ const char *bh_io_classname(bh_io_t *io); * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_io_open(bh_io_t *io, - int mode); +int BH_IOOpen(BH_IO *io, + int mode); /** @@ -121,7 +122,7 @@ int bh_io_open(bh_io_t *io, * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_io_close(bh_io_t *io); +int BH_IOClose(BH_IO *io); /** @@ -135,10 +136,10 @@ int bh_io_close(bh_io_t *io); * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_io_read(bh_io_t *io, - char *buffer, - size_t size, - size_t *actual); +int BH_IORead(BH_IO *io, + char *buffer, + size_t size, + size_t *actual); /** @@ -152,10 +153,10 @@ int bh_io_read(bh_io_t *io, * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_io_write(bh_io_t *io, - const char *buffer, - size_t size, - size_t *actual); +int BH_IOWrite(BH_IO *io, + const char *buffer, + size_t size, + size_t *actual); /** @@ -169,10 +170,10 @@ int bh_io_write(bh_io_t *io, * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_io_peek(bh_io_t *io, - char *buffer, - size_t size, - size_t *actual); +int BH_IOPeek(BH_IO *io, + char *buffer, + size_t size, + size_t *actual); /** @@ -184,8 +185,8 @@ int bh_io_peek(bh_io_t *io, * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_io_tell(bh_io_t *io, - int64_t *position); +int BH_IOTell(BH_IO *io, + int64_t *position); /** @@ -198,9 +199,9 @@ int bh_io_tell(bh_io_t *io, * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_io_seek(bh_io_t *io, - int64_t position, - int direction); +int BH_IOSeek(BH_IO *io, + int64_t position, + int direction); /** @@ -211,7 +212,7 @@ int bh_io_seek(bh_io_t *io, * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_io_flush(bh_io_t *io); +int BH_IOFlush(BH_IO *io); /** @@ -223,8 +224,8 @@ int bh_io_flush(bh_io_t *io); * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_io_size(bh_io_t *io, - int64_t *size); +int BH_IOSize(BH_IO *io, + int64_t *size); /** @@ -234,7 +235,7 @@ int bh_io_size(bh_io_t *io, * * \return Flags of the IO */ -int bh_io_flags(bh_io_t *io); +int BH_IOFlags(BH_IO *io); /** @@ -245,7 +246,7 @@ int bh_io_flags(bh_io_t *io); * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_io_clear(bh_io_t *io); +int BH_IOClear(BH_IO *io); #endif /* BH_IO_H */ diff --git a/include/bh/math.h b/include/bh/math.h index 25aef35..5471a4a 100644 --- a/include/bh/math.h +++ b/include/bh/math.h @@ -6,1888 +6,1395 @@ /** - * 2D floating point vector. - */ -typedef struct bh_point2f_s -{ - /** X component */ - float x; - - /** Y Component */ - float y; -} bh_point2f_t; - - -/** - * 3D floating point vector. - */ -typedef struct bh_point3f_s -{ - /** X component */ - float x; - - /** Y component */ - float y; - - /** Z component */ - float z; -} bh_point3f_t; - - -/** - * 4D floating point vector. - */ -typedef struct bh_point4f_s -{ - /** X component */ - float x; - - /** Y component */ - float y; - - /** Z component */ - float z; - - /** W component */ - float w; -} bh_point4f_t; - - -/** - * 2D integer vector. - */ -typedef struct bh_point2i_s -{ - /** X component */ - int x; - - /** Y component */ - int y; -} bh_point2i_t; - - -/** - * 3D integer vector. - */ -typedef struct bh_point3i_s -{ - /** X component */ - int x; - - /** Y component */ - int y; - - /** Z component */ - int z; -} bh_point3i_t; - - -/** - * 4D integer vector. - */ -typedef struct bh_point4i_s -{ - /** X component */ - int x; - - /** Y component */ - int y; - - /** Z component */ - int z; - - /** W component */ - int w; -} bh_point4i_t; - - -/** - * 3x3 floating point matrix. - * - * Each vector represent one column of the matrix. - */ -typedef struct bh_matrix3f_s -{ - /** First column */ - bh_point3f_t x; - - /** Second column */ - bh_point3f_t y; - - /** Third colum */ - bh_point3f_t z; -} bh_matrix3f_t; - - -/** - * 4x4 floating point matrix. - * - * Each vector represent one column of the matrix. - */ -typedef struct bh_matrix4f_s -{ - /** First column */ - bh_point4f_t x; - - /** Second column */ - bh_point4f_t y; - - /** Third column */ - bh_point4f_t z; - - /** Forth column */ - bh_point4f_t w; -} bh_matrix4f_t; - - -/** - * 2D floating point line. - */ -typedef struct bh_line2f_s -{ - /** Normal vector */ - bh_point2f_t normal; - - /** Distance from the origin */ - float distance; -} bh_line2f_t; - - -/** - * 3D floating point line. - */ -typedef struct bh_line3f_s -{ - /** Origin */ - bh_point3f_t origin; - - /** Normal vector */ - bh_point3f_t normal; -} bh_line3f_t; - - -/** - * 3D floating point plane. - */ -typedef struct bh_plane3f_s -{ - /** Normal vector */ - bh_point3f_t normal; - - /** Distance from the origin */ - float distance; -} bh_plane3f_t; - - -/** - * 2D floating point ray. - */ -typedef struct bh_ray2f_s -{ - /** Origin */ - bh_point2f_t origin; - - /** Normal or direction */ - bh_point2f_t normal; -} bh_ray2f_t; - - -/** - * 3D floating point ray. - */ -typedef bh_line3f_t bh_ray3f_t; - -/** - * 2D floating point AABB - */ -typedef struct bh_aabb2f_s -{ - /** Origin */ - bh_point2f_t origin; - - /** Size */ - bh_point2f_t size; -} bh_aabb2f_t; - - -/** - * 3D floating point AABB - */ -typedef struct bh_aabb3f_s -{ - /** Origin */ - bh_point3f_t origin; - - /** Size */ - bh_point3f_t size; -} bh_aabb3f_t; - - -/** - * 2D integer AABB - */ -typedef struct bh_aabb2i_s -{ - /** Origin */ - bh_point2i_t origin; - - /** Size */ - bh_point2i_t size; -} bh_aabb2i_t; - - -/** - * 3D integer AABB - */ -typedef struct bh_aabb3i_s -{ - /** Origin */ - bh_point3i_t origin; - - /** Size */ - bh_point3i_t size; -} bh_aabb3i_t; - - -/** - * Floating point quaternion - */ -typedef bh_point4f_t bh_quat_t; - - -/** - * Adds components of two vectors. - * - * result = a + b - * - * \param a Value - * \param b Value - * \param result Result - */ -void bh_point4f_add(const bh_point4f_t *a, - const bh_point4f_t *b, - bh_point4f_t *result); - - -/** - * Subtracts components of two vectors. - * - * result = a - b - * - * \param a Value - * \param b Value - * \param result Result - */ -void bh_point4f_sub(const bh_point4f_t *a, - const bh_point4f_t *b, - bh_point4f_t *result); - - -/** - * Multiplies components of two vectors. - * - * result = a * b - * - * \param a Value - * \param b Value - * \param result Result - */ -void bh_point4f_mul(const bh_point4f_t *a, - const bh_point4f_t *b, - bh_point4f_t *result); - - -/** - * Scales the vector. - * - * result = a * b - * - * \param a Value - * \param b Factor - * \param result Result - */ -void bh_point4f_scale(const bh_point4f_t *a, - float b, - bh_point4f_t *result); - - -/** - * Multiplies and adds three vectors. - * - * result = a * b + c - * - * \param a Value - * \param b Value - * \param c Value - * \param result Result - */ -void bh_point4f_madd(const bh_point4f_t *a, - const bh_point4f_t *b, - const bh_point4f_t *c, - bh_point4f_t *result); - - -/** - * Negates the vector. - * - * result = -in + * Adds \a a and \a b floating point vectors and stores result into \a out. * - * \param in Value - * \param result Result + * \param a A 4D vector + * \param b B 4D vector + * \param out Output 4D vector */ -void bh_point4f_negate(const bh_point4f_t *in, - bh_point4f_t *result); +void BH_Vec4fAdd(const float *a, + const float *b, + float *out); /** - * Calculates the dot product of two vectors. + * Subtracts \a a and \a b floating point vectors and stores result into \a out. * - * \param a Value - * \param b Value - * - * \return Returns the dot product. + * \param a A 4D vector + * \param b B 4D vector + * \param out Output 4D vector */ -float bh_point4f_dot(const bh_point4f_t *a, - const bh_point4f_t *b); +void BH_Vec4fSub(const float *a, + const float *b, + float *out); /** - * Calculates the dot product of two vectors with w component. - * - * \param a Value - * \param b Value + * Multiplies \a a and \a b floating point vectors and stores result into + * \a out. * - * \return Returns the dot product. + * \param a A 4D vector + * \param b B 4D vector + * \param out Output 4D vector */ -float bh_point4f_dot3(const bh_point4f_t *a, - const bh_point4f_t *b); +void BH_Vec4fMul(const float *a, + const float *b, + float *out); /** - * Calculates the cross product of two vectors without w component. + * Scales \a a vector by the value \a b and stores result into \a out. * - * result = a x b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4D vector + * \param b B value + * \param out Output vector */ -void bh_point4f_cross(const bh_point4f_t *a, - const bh_point4f_t *b, - bh_point4f_t *result); +void BH_Vec4fScale(const float *a, + float b, + float *out); /** - * Calculates the length of the vector. - * - * \param in Value + * Multiples \a a and \a b vectors, adds to \a c and stores result into \a out. * - * \return Returns the length. + * \param a A 4D vector + * \param b B 4D vector + * \param c C 4D vector + * \param out Output 4D vector */ -float bh_point4f_length(const bh_point4f_t *in); +void BH_Vec4fMulAdd(const float *a, + const float *b, + const float *c, + float *out); /** - * Normilizes the vector. + * Negates \a in vector and stores result into \a out. * - * result = in / |in| - * - * \param in Value - * \param result Result + * \param in Input 4D vector + * \param out Output 4D vector */ -void bh_point4f_normal(const bh_point4f_t *in, - bh_point4f_t *result); +void BH_Vec4fNegate(const float *in, + float *out); /** - * Calculates vector, containing minimum components of two vectors. - * - * result = min(a, b) + * Computes dot product of \a a and \a b vectors and returns the result. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4D vector + * \param b B 4D vector */ -void bh_point4f_min(const bh_point4f_t *a, - const bh_point4f_t *b, - bh_point4f_t *result); +float BH_Vec4fDot(const float *a, + const float *b); /** - * Calculates vector, containing maximum components of two vectors. + * Computes length of the \a in vector and returns the result. * - * result = max(a, b) - * - * \param a Value - * \param b Value - * \param result Result + * \param in Input 4D vector */ -void bh_point4f_max(const bh_point4f_t *a, - const bh_point4f_t *b, - bh_point4f_t *result); +float BH_Vec4fLength(const float *in); /** - * Calculates linear interpolation between two vectors. - * - * result = a + (b - a) * t + * Computes normal vector from the \a in and stores result into \a out. * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param in Input 4D vector + * \param out Output 4D vector */ -void bh_point4f_lerp(const bh_point4f_t *a, - const bh_point4f_t *b, - float t, - bh_point4f_t *result); +void BH_Vec4fNormal(const float *in, + float *out); /** - * Calculates spherical linear interpolation between two vectors. + * Computes minimum vector from the \a a and \a b vectors and stores result + * into \a out. * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param a A 4D vector + * \param b B 4D vector + * \param out Output 4D vector */ -void bh_point4f_slerp(const bh_point4f_t *a, - const bh_point4f_t *b, - float t, - bh_point4f_t *result); +void BH_Vec4fMin(const float *a, + const float *b, + float *out); /** - * Adds components of two vectors. + * Computes maximum vector from the \a a and \a b vectors and stores result + * into \a out. * - * result = a + b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4D vector + * \param b B 4D vector + * \param out Output 4D vector */ -void bh_point3f_add(const bh_point3f_t *a, - const bh_point3f_t *b, - bh_point3f_t *result); +void BH_Vec4fMax(const float *a, + const float *b, + float *out); /** - * Subtracts components of two vectors. - * - * result = a - b + * Interpolates between \a a and \a b vector by \a t amount and stores result + * into \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4D vector + * \param b B 4D vector + * \param t Amount + * \param out Output 4D vector */ -void bh_point3f_sub(const bh_point3f_t *a, - const bh_point3f_t *b, - bh_point3f_t *result); +void BH_Vec4fLerp(const float *a, + const float *b, + float t, + float *out); /** - * Multiplies components of two vectors. + * Adds \a a and \a b floating point vectors and stores result into \a out. * - * result = a * b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point3f_mul(const bh_point3f_t *a, - const bh_point3f_t *b, - bh_point3f_t *result); +void BH_Vec3fAdd(const float *a, + const float *b, + float *out); /** - * Scales the vector. - * - * result = a * b + * Subtracts \a a and \a b floating point vectors and stores result into \a out. * - * \param a Value - * \param b Factor - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point3f_scale(const bh_point3f_t *a, - float b, - bh_point3f_t *result); +void BH_Vec3fSub(const float *a, + const float *b, + float *out); /** - * Multiplies and adds three vectors. + * Multiplies \a a and \a b floating point vectors and stores result into + * \a out. * - * result = a * b + c - * - * \param a Value - * \param b Value - * \param c Value - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point3f_madd(const bh_point3f_t *a, - const bh_point3f_t *b, - const bh_point3f_t *c, - bh_point3f_t *result); +void BH_Vec3fMul(const float *a, + const float *b, + float *out); /** - * Negates the vector. - * - * result = -in + * Scales \a a vector by the value \a b and stores result into \a out. * - * \param in Value - * \param result Result + * \param a A 3D vector + * \param b B value + * \param out Output 3D vector */ -void bh_point3f_negate(const bh_point3f_t *in, - bh_point3f_t *result); +void BH_Vec3fScale(const float *a, + float b, + float *out); /** - * Calculates the dot product of two vectors. + * Multiples \a a and \a b vectors, adds to \a c and stores result into \a out. * - * \param a Value - * \param b Value - * - * \return Returns the dot product. + * \param a A 3D vector + * \param b B 3D vector + * \param c C 3D vector + * \param out Output 3D vector */ -float bh_point3f_dot(const bh_point3f_t *a, - const bh_point3f_t *b); +void BH_Vec3fMulAdd(const float *a, + const float *b, + const float *c, + float *out); /** - * Calculates the cross product of two vectors. + * Negates \a in vector and stores result into \a out. * - * result = a x b + * \param in Input 3D vector + * \param out Output 3D vector * - * \param a Value - * \param b Value - * \param result Result */ -void bh_point3f_cross(const bh_point3f_t *a, - const bh_point3f_t *b, - bh_point3f_t *result); +void BH_Vec3fNegate(const float *in, + float *out); /** - * Calculates the length of the vector. - * - * \param in Value + * Computes dot product of \a a and \a b vectors and returns the result. * - * \return Returns the length. + * \param a A 3D vector + * \param b B 3D vector */ -float bh_point3f_length(const bh_point3f_t *in); +float BH_Vec3fDot(const float *a, + const float *b); /** - * Normilizes the vector. + * Computes cross product of \a a and \a b vectors and stores + * result into \a out. * - * result = in / |in| - * - * \param in Value - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point3f_normal(const bh_point3f_t *in, - bh_point3f_t *result); +void BH_Vec3fCross(const float *a, + const float *b, + float *out); /** - * Calculates vector, containing minimum components of two vectors. - * - * result = min(a, b) + * Computes length of the \a in vector and returns the result. * - * \param a Value - * \param b Value - * \param result Result + * \param in Input 3D vector */ -void bh_point3f_min(const bh_point3f_t *a, - const bh_point3f_t *b, - bh_point3f_t *result); +float BH_Vec3fLength(const float *in); /** - * Calculates vector, containing maximum components of two vectors. + * Computes normal vector from the \a in and stores result into \a out. * - * result = max(a, b) - * - * \param a Value - * \param b Value - * \param result Result + * \param in Input 3D vector + * \param out Output 3D vector */ -void bh_point3f_max(const bh_point3f_t *a, - const bh_point3f_t *b, - bh_point3f_t *result); +void BH_Vec3fNormal(const float *in, + float *out); /** - * Calculates linear interpolation between two vectors. - * - * result = a + (b - a) * t + * Computes minimum vector from the \a a and \a b vectors and stores result into + * \a out. * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point3f_lerp(const bh_point3f_t *a, - const bh_point3f_t *b, - float t, - bh_point3f_t *result); +void BH_Vec3fMin(const float *a, + const float *b, + float *out); /** - * Calculates spherical linear interpolation between two vectors. + * Computes maximum vector from the \a a and \a b vectors and stores result into + * \a out. * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point3f_slerp(const bh_point3f_t *a, - const bh_point3f_t *b, - float t, - bh_point3f_t *result); +void BH_Vec3fMax(const float *a, + const float *b, + float *out); /** - * Adds components of two vectors. + * Interpolates between \a a and \a b vector by \a t amount and stores result + * into \a out. * - * result = a + b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param t Amount + * \param out Output 3D vector */ -void bh_point2f_add(const bh_point2f_t *a, - const bh_point2f_t *b, - bh_point2f_t *result); +void BH_Vec3fLerp(const float *a, + const float *b, + float t, + float *out); /** - * Subtracts components of two vectors. - * - * result = a - b + * Adds \a a and \a b floating point vectors and stores result into \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_point2f_sub(const bh_point2f_t *a, - const bh_point2f_t *b, - bh_point2f_t *result); +void BH_Vec2fAdd(const float *a, + const float *b, + float *out); /** - * Multiplies components of two vectors. + * Subtracts \a a and \a b floating point vectors and stores result into \a out. * - * result = a * b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_point2f_mul(const bh_point2f_t *a, - const bh_point2f_t *b, - bh_point2f_t *result); +void BH_Vec2fSub(const float *a, + const float *b, + float *out); /** - * Scales the vector. - * - * result = a * b + * Multiplies \a a and \a b floating point vectors and stores result into + * \a out. * - * \param a Value - * \param b Factor - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_point2f_scale(const bh_point2f_t *a, - float b, - bh_point2f_t *result); +void BH_Vec2fMul(const float *a, + const float *b, + float *out); /** - * Multiplies and adds three vectors. + * Scales \a a vector by the value \a b and stores result into \a out. * - * result = a * b + c - * - * \param a Value - * \param b Value - * \param c Value - * \param result Result + * \param a A 2D vector + * \param b B value + * \param out Output 2D vector */ -void bh_point2f_madd(const bh_point2f_t *a, - const bh_point2f_t *b, - const bh_point2f_t *c, - bh_point2f_t *result); +void BH_Vec2fScale(const float *a, + float b, + float *out); /** - * Negates the vector. - * - * result = -in + * Multiples \a a and \a b vectors, adds to \a c and stores result into \a out. * - * \param in Value - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param c C 2D vector + * \param out Output 2D vector */ -void bh_point2f_negate(const bh_point2f_t *in, - bh_point2f_t *result); +void BH_Vec2fMulAdd(const float *a, + const float *b, + const float *c, + float *out); /** - * Calculates the dot product of two vectors. + * Negates \a in vector and stores result into \a out. * - * \param a Value - * \param b Value + * \param in Input 2D vector + * \param out Output 2D vector * - * \return Returns the dot product. */ -float bh_point2f_dot(const bh_point2f_t *a, - const bh_point2f_t *b); +void BH_Vec2fNegate(const float *in, + float *out); /** - * Calculates the cross product of two vectors and returns its z component. - * - * result = a x b - * - * \param a Value - * \param b Value + * Computes dot product of \a a and \a b vectors and returns the result. * - * \return Returns z component of the result vector. + * \param a A 2D vector + * \param b B 2D vector */ -float bh_point2f_cross(const bh_point2f_t *a, - const bh_point2f_t *b); +float BH_Vec2fDot(const float *a, + const float *b); /** - * Calculates the length of the vector. + * Computes cross product of \a a and \a b vectors and returns the result. * - * \param in Value - * - * \return Returns the length. + * \param a A 2D vector + * \param b B 2D vector */ -float bh_point2f_length(const bh_point2f_t *in); +float BH_Vec2fCross(const float *a, + const float *b); /** - * Normilizes the vector. - * - * result = in / |in| + * Computes length of the \a in vector and returns the result. * - * \param in Value - * \param result Result + * \param in Input 2D vector */ -void bh_point2f_normal(const bh_point2f_t *in, - bh_point2f_t *result); +float BH_Vec2fLength(const float *in); /** - * Calculates vector, containing minimum components of two vectors. + * Computes normal vector from the \a in and stores result into + * \a out. * - * result = min(a, b) - * - * \param a Value - * \param b Value - * \param result Result + * \param in Input 2D vector + * \param out Output 2D vector */ -void bh_point2f_min(const bh_point2f_t *a, - const bh_point2f_t *b, - bh_point2f_t *result); +void BH_Vec2fNormal(const float *in, + float *out); /** - * Calculates vector, containing maximum components of two vectors. - * - * result = max(a, b) + * Computes minimum vector from the \a a and \a b vectors and stores result into + * \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_point2f_max(const bh_point2f_t *a, - const bh_point2f_t *b, - bh_point2f_t *result); +void BH_Vec2fMin(const float *a, + const float *b, + float *out); /** - * Calculates linear interpolation between two vectors. + * Computes maximum vector from the \a a and \a b vectors and stores result into + * \a out. * - * result = a + (b - a) * t - * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_point2f_lerp(const bh_point2f_t *a, - const bh_point2f_t *b, - float t, - bh_point2f_t *result); +void BH_Vec2fMax(const float *a, + const float *b, + float *out); /** - * Calculates spherical linear interpolation between two vectors. + * Interpolates between \a a and \a b vector by \a t amount and stores result + * into \a out. * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param t Amount + * \param out Output 2D vector */ -void bh_point2f_slerp(const bh_point2f_t *a, - const bh_point2f_t *b, - float t, - bh_point2f_t *result); +void BH_Vec2fLerp(const float *a, + const float *b, + float t, + float *out); /** - * Adds components of two vectors. - * - * result = a + b + * Adds \a a and \a b integer vectors and stores result into \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4D vector + * \param b B 4D vector + * \param out Output 4D vector */ -void bh_point4i_add(const bh_point4i_t *a, - const bh_point4i_t *b, - bh_point4i_t *result); +void BH_Vec4iAdd(const int *a, + const int *b, + int *out); /** - * Subtracts components of two vectors. + * Subtracts \a a and \a b integer vectors and stores result into \a out. * - * result = a - b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4D vector + * \param b B 4D vector + * \param out Output 4D vector */ -void bh_point4i_sub(const bh_point4i_t *a, - const bh_point4i_t *b, - bh_point4i_t *result); +void BH_Vec4iSub(const int *a, + const int *b, + int *out); /** - * Multiplies components of two vectors. - * - * result = a * b + * Multiplies \a a and \a b integers vectors and stores result into \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4D vector + * \param b B 4D vector + * \param out Output vector */ -void bh_point4i_mul(const bh_point4i_t *a, - const bh_point4i_t *b, - bh_point4i_t *result); +void BH_Vec4iMul(const int *a, + const int *b, + int *out); /** - * Scales the vector. + * Scales \a a vector by the value \a b and stores result into \a out. * - * result = a * b - * - * \param a Value - * \param b Factor - * \param result Result + * \param a A 4D vector + * \param b B value + * \param out Output 4D vector */ -void bh_point4i_scale(const bh_point4i_t *a, - int b, - bh_point4i_t *result); +void BH_Vec4iScale(const int *a, + int b, + int *out); /** - * Multiplies and adds three vectors. - * - * result = a * b + c + * Multiples \a a and \a b vectors, adds to \a c and stores result into \a out. * - * \param a Value - * \param b Value - * \param c Value - * \param result Result + * \param a A 4D vector + * \param b B 4D vector + * \param c C 4D vector + * \param out Output 4D vector */ -void bh_point4i_madd(const bh_point4i_t *a, - const bh_point4i_t *b, - const bh_point4i_t *c, - bh_point4i_t *result); +void BH_Vec4iMulAdd(const int *a, + const int *b, + const int *c, + int *out); /** - * Negates the vector. + * Negates \a in vector and stores result into \a out. * - * result = -in - * - * \param in Value - * \param result Result + * \param in Input 4D vector + * \param out Output 4D vector */ -void bh_point4i_negate(const bh_point4i_t *in, - bh_point4i_t *result); +void BH_Vec4iNegate(const int *in, + int *out); /** - * Calculates vector, containing minimum components of two vectors. - * - * result = min(a, b) + * Computes minimum vector from the \a a and \a b vectors and stores result into + * \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4D vector + * \param b B 4D vector + * \param out Output 4D vector */ -void bh_point4i_min(const bh_point4i_t *a, - const bh_point4i_t *b, - bh_point4i_t *result); +void BH_Vec4iMin(const int *a, + const int *b, + int *out); /** - * Calculates vector, containing maximum components of two vectors. + * Computes maximum vector from the \a a and \a b vectors and stores result into + * \a out. * - * result = max(a, b) - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4D vector + * \param b B 4D vector + * \param out Output 4D vector */ -void bh_point4i_max(const bh_point4i_t *a, - const bh_point4i_t *b, - bh_point4i_t *result); +void BH_Vec4iMax(const int *a, + const int *b, + int *out); /** - * Calculates linear interpolation between two vectors. - * - * result = a + (b - a) * t + * Adds \a a and \a b integer vectors and stores result into \a out. * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point4i_lerp(const bh_point4i_t *a, - const bh_point4i_t *b, - float t, - bh_point4i_t *result); +void BH_Vec3iAdd(const int *a, + const int *b, + int *out); /** - * Adds components of two vectors. + * Subtracts \a a and \a b integer vectors and stores result into \a out. * - * result = a + b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point3i_add(const bh_point3i_t *a, - const bh_point3i_t *b, - bh_point3i_t *result); +void BH_Vec3iSub(const int *a, + const int *b, + int *out); /** - * Subtracts components of two vectors. - * - * result = a - b + * Multiplies \a a and \a b integers vectors and stores result into \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point3i_sub(const bh_point3i_t *a, - const bh_point3i_t *b, - bh_point3i_t *result); +void BH_Vec3iMul(const int *a, + const int *b, + int *out); /** - * Multiplies components of two vectors. + * Scales \a a vector by the value \a b and stores result into \a out. * - * result = a * b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 3D vector + * \param b B value + * \param out Output 3D vector */ -void bh_point3i_mul(const bh_point3i_t *a, - const bh_point3i_t *b, - bh_point3i_t *result); +void BH_Vec3iScale(const int *a, + int b, + int *out); /** - * Scales the vector. - * - * result = a * b + * Multiples \a a and \a b vectors, adds to \a c and stores result into \a out. * - * \param a Value - * \param b Factor - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param c C 3D vector + * \param out Output 3D vector */ -void bh_point3i_scale(const bh_point3i_t *a, - int b, - bh_point3i_t *result); +void BH_Vec3iMulAdd(const int *a, + const int *b, + const int *c, + int *out); /** - * Multiplies and adds three vectors. + * Negates \a in vector and stores result into \a out. * - * result = a * b + c + * \param in Input 3D vector + * \param out Output 3D vector * - * \param a Value - * \param b Value - * \param c Value - * \param result Result */ -void bh_point3i_madd(const bh_point3i_t *a, - const bh_point3i_t *b, - const bh_point3i_t *c, - bh_point3i_t *result); +void BH_Vec3iNegate(const int *in, + int *out); /** - * Negates the vector. + * Computes minimum vector from the \a a and \a b vectors and stores result into + * \a out. * - * result = -in - * - * \param in Value - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point3i_negate(const bh_point3i_t *in, - bh_point3i_t *result); +void BH_Vec3iMin(const int *a, + const int *b, + int *out); /** - * Calculates vector, containing minimum components of two vectors. - * - * result = min(a, b) + * Computes maximum vector from the \a a and \a b vectors and stores result into + * \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 3D vector + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_point3i_min(const bh_point3i_t *a, - const bh_point3i_t *b, - bh_point3i_t *result); +void BH_Vec3iMax(const int *a, + const int *b, + int *out); /** - * Calculates vector, containing maximum components of two vectors. + * Adds \a a and \a b integer vectors and stores result into \a out. * - * result = max(a, b) - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_point3i_max(const bh_point3i_t *a, - const bh_point3i_t *b, - bh_point3i_t *result); +void BH_Vec2iAdd(const int *a, + const int *b, + int *out); /** - * Calculates linear interpolation between two vectors. - * - * result = a + (b - a) * t + * Subtracts \a a and \a b integer vectors and stores result into \a out. * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_point3i_lerp(const bh_point3i_t *a, - const bh_point3i_t *b, - float t, - bh_point3i_t *result); +void BH_Vec2iSub(const int *a, + const int *b, + int *out); /** - * Adds components of two vectors. + * Multiplies \a a and \a b integers vectors and stores result into \a out. * - * result = a + b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_point2i_add(const bh_point2i_t *a, - const bh_point2i_t *b, - bh_point2i_t *result); +void BH_Vec2iMul(const int *a, + const int *b, + int *out); /** - * Subtracts components of two vectors. - * - * result = a - b + * Scales \a a vector by the value \a b and stores result into \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 2D vector + * \param b B 2D value + * \param out Output 2D vector */ -void bh_point2i_sub(const bh_point2i_t *a, - const bh_point2i_t *b, - bh_point2i_t *result); +void BH_Vec2iScale(const int *a, + int b, + int *out); /** - * Multiplies components of two vectors. + * Multiples \a a and \a b vectors, adds to \a c and stores result into \a out. * - * result = a * b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param c C 2D vector + * \param out Output 2D vector */ -void bh_point2i_mul(const bh_point2i_t *a, - const bh_point2i_t *b, - bh_point2i_t *result); +void BH_Vec2iMulAdd(const int *a, + const int *b, + const int *c, + int *out); /** - * Scales the vector. + * Negates \a in vector and stores result into \a out. * - * result = a * b + * \param in Input 2D vector + * \param out Output 2D vector * - * \param a Value - * \param b Factor - * \param result Result */ -void bh_point2i_scale(const bh_point2i_t *a, - int b, - bh_point2i_t *result); +void BH_Vec2iNegate(const int *in, + int *out); /** - * Multiplies and adds three vectors. - * - * result = a * b + c + * Computes minimum vector from the \a a and \a b vectors and stores result into + * \a out. * - * \param a Value - * \param b Value - * \param c Value - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_point2i_madd(const bh_point2i_t *a, - const bh_point2i_t *b, - const bh_point2i_t *c, - bh_point2i_t *result); +void BH_Vec2iMin(const int *a, + const int *b, + int *out); /** - * Negates the vector. + * Computes maximum vector from the \a a and \a b vectors and stores result into + * \a out. * - * result = -in - * - * \param in Value - * \param result Result + * \param a A 2D vector + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_point2i_negate(const bh_point2i_t *in, - bh_point2i_t *result); +void BH_Vec2iMax(const int *a, + const int *b, + int *out); /** - * Calculates vector, containing minimum components of two vectors. - * - * result = min(a, b) + * Adds \a a and \a b floating point quaternions and stores result into \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A quaternion + * \param b B quaternion + * \param out Output quaternion */ -void bh_point2i_min(const bh_point2i_t *a, - const bh_point2i_t *b, - bh_point2i_t *result); +#define BH_Quat4fAdd(a, b, out) \ + BH_Vec4fAdd(a, b, out) /** - * Calculates vector, containing maximum components of two vectors. + * Subtracts \a a and \a b floating point quaternions and stores result into + * \a out. * - * result = max(a, b) - * - * \param a Value - * \param b Value - * \param result Result + * \param a A quaternion + * \param b B quaternion + * \param out Output quaternion */ -void bh_point2i_max(const bh_point2i_t *a, - const bh_point2i_t *b, - bh_point2i_t *result); +#define BH_Quat4fSub(a, b, out) \ + BH_Vec4fSub(a, b, out) /** - * Calculates linear interpolation between two vectors. - * - * result = a + (b - a) * t + * Scales \a a quaternion by the value \a b and stores result into \a out. * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param a A quaternion + * \param b B value + * \param out Output quaternion */ -void bh_point2i_lerp(const bh_point2i_t *a, - const bh_point2i_t *b, - float t, - bh_point2i_t *result); +#define BH_Quat4fScale(a, b, out) \ + BH_Vec4fScale(a, b, out) /** - * Adds components of two quaternions. - * - * result = a + b + * Negates \a in quaternion and stores result into \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param in Input quaternion + * \param out Output quaternion */ -#define bh_quat_add bh_point4f_add +#define BH_Quat4fNegate(in, out) \ + BH_Vec4fNegate(in, out) /** - * Subtracts components of two quaternions. + * Computes dot product of \a a and \a b quaternions and returns the result. * - * result = a - b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A quaternion + * \param b B quaternion */ -#define bh_quat_sub bh_point4f_sub +#define BH_Quat4fDot(a, b) \ + BH_Vec4fDot(a, b) /** - * Scales the quaternion. - * - * result = a * b + * Computes length of the \a in quaternion and returns the result. * - * \param a Value - * \param b Factor - * \param result Result + * \param in Input quaternion */ -#define bh_quat_scale bh_point4f_scale +#define BH_Quat4fLength(in) \ + BH_Vec4fLength(in) /** - * Negates the quaternion. + * Computes normal quaternion from the \a in and stores result into \a out. * - * result = -in - * - * \param in Value - * \param result Result + * \param in Input quaternion + * \param out Output quaternion */ -#define bh_quat_negate bh_point4f_negate +#define BH_Quat4fNormal(in, out) \ + BH_Vec4fNormal(in, out) /** - * Calculates the dot product of two quaternions. - * - * \param a Value - * \param b Value + * Interpolates between \a a and \a b quaternion by \a t amount and stores + * result into \a out. * - * \return Returns the dot product. + * \param a A quaternion + * \param b B quaternion + * \param t Amount + * \param out Output quaternion */ -#define bh_quat_dot bh_point4f_dot +#define BH_Quat4fLerp(a, b, t, out) \ + BH_Vec4fLerp(a, b, t, out) /** - * Calculates the length of the quaternion. + * Stores identity quaternion into \a out. * - * \param in Value - * - * \return Returns the length. + * \param out Output quaternion. */ -#define bh_quat_length bh_point4f_length +void BH_Quat4fIdentity(float *out); /** - * Normilizes the quaternion. - * - * result = in / |in| + * Conjugates the \a in quaternion and stores result into \a out. * - * \param in Value - * \param result Result + * \param in Input quaternion + * \param out Output quaternion */ -#define bh_quat_normal bh_point4f_normal +void BH_Quat4fConjugate(const float *in, + float *out); /** - * Calculates linear interpolation between two quaternions. + * Computes the inverse of the \a in quaternion and stores result into \a out. * - * result = a + (b - a) * t - * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param in Input quaternion + * \param out Output quaternion */ -#define bh_quat_lerp bh_point4f_lerp +void BH_Quat4fInverse(const float *in, + float *out); /** - * Calculates spherical linear interpolation between two quaternions. + * Multiplies the \a a and \a b quaternions and stores result into \a out. * - * \param a Value - * \param b Value - * \param t Factor - * \param result Result + * \param a A quaternion + * \param b B quaternion + * \param out Output quaternion */ -#define bh_quat_slerp bh_point4f_slerp +void BH_Quat4fMul(const float *a, + const float *b, + float *out); /** - * Sets quaternions to identity. + * Spherically interpolates between \a a and \a b quaternions by \a t amount and + * stores result into \a out. * - * \param result Result + * \param a A quaternion + * \param b B quaternion + * \param t Amount + * \param out Output quaternion */ -void bh_quat_identity(bh_quat_t *result); +void BH_Quat4fSlerp(const float *a, + const float *b, + float t, + float *out); /** - * Conjugates the quaternion. - * - * result = (-in.x, -in.y, -in.z, in.w) + * Computes the quaternion that represents \a roll, \a pitch, \a yaw (euler + * angles) and stores result into \a out. * - * \param in Value - * \param result Result - */ -void bh_quat_conjugate(const bh_quat_t *in, - bh_quat_t *result); - - -/** - * Calculates the inverse of the quaternion. + * Order of the rotation is ZYX (yaw, pitch, roll) * - * \param in Value - * \param result Result - */ -void bh_quat_inverse(const bh_quat_t *in, - bh_quat_t *result); - - -/** - * Multiplies two quaternions. - * - * result = a * b - * - * \param a Value - * \param b Value - * \param result Result - */ -void bh_quat_mul(const bh_quat_t *a, - const bh_quat_t *b, - bh_quat_t *result); - - -/** - * Sets quaternion from euler angles (roll, pitch, yaw). - * - * Order of the rotation is ZYX (yaw, pitch, roll). - * - * \param roll Roll - * \param pitch Pitch - * \param yaw Yaw - * \param result Result + * \param roll Roll + * \param pitch Pitch + * \param yaw Yaw + * \param out Output quaternion */ -void bh_quat_set_euler(float roll, - float pitch, - float yaw, - bh_quat_t *result); +void BH_Quat4fFromEuler(float roll, + float pitch, + float yaw, + float *out); /** - * Sets quaternion from axis of rotation and angle. + * Computes quaternion that represents rotation by angle \a angle around + * axis \a axis and stores result into \a out. * - * \param axis Axis - * \param angle Angle - * \param result Result + * \param axis Axis 3D vector + * \param angle Angle + * \param out Output quaternion */ -void bh_quat_set_rotation(const bh_point3f_t *axis, - float angle, - bh_quat_t *result); +void BH_Quat4fFromAxis(const float *axis, + float angle, + float *out); /** - * Calculates euler angles (roll, pitch, yaw) from quaternion. + * Computes euler angles from quaternion \a in and stores result into \a roll, + * \a pitch, \a yaw. * - * Order of the rotation is ZYX (yaw, pitch, roll). + * Order of the rotation is ZYX (yaw, pitch, roll) * - * \param in Value - * \param roll Roll - * \param pitch Pitch - * \param yaw Yaw + * \param in Input quaternion + * \param roll Output roll + * \param pitch Output pitch + * \param yaw Output yaw */ -void bh_quat_euler(const bh_quat_t *in, - float *roll, - float *pitch, - float *yaw); +void BH_Quat4fToEuler(const float *in, + float *roll, + float *pitch, + float *yaw); /** - * Calculates axis of rotation and angle from quaternion. + * Computes rotation around axis from quaternion \a in and stores result into + * \a axis and \a angle. * - * \param in Value - * \param axis Axis - * \param angle Angle + * \param in Input quaternion + * \param axis Output axis 3D vector + * \param angle Output angle */ -void bh_quat_rotation(const bh_quat_t *in, - bh_point3f_t *axis, - float *angle); +void BH_Quat4fToAxis(const float *in, + float *axis, + float *angle); /** - * Calculates rotation matrix from quaternion. + * Computes 4x4 rotation matrix from quaternion \a in and stores result into + * \a out. * - * \param in Value - * \param result Result + * \param in Input quaternion + * \param out Output 4x4 matrix */ -void bh_quat_matrix(const bh_quat_t *in, - bh_matrix4f_t *result); +void BH_Quat4fToMat4f(const float *in, + float *out); /** - * Sets matrix to identity. + * Stores identity matrix into \a out. * - * \param result Result + * \param out Output 4x4 matrix. */ -void bh_matrix4f_identity(bh_matrix4f_t *result); +void BH_Mat4fIdentity(float *out); /** - * Adds two matricies. - * - * result = a + b + * Adds \a a and \a b floating point matricies and stores result into \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4x4 matrix + * \param b B 4x4 matrix + * \param out Output 4x4 matrix */ -void bh_matrix4f_add(const bh_matrix4f_t *a, - const bh_matrix4f_t *b, - bh_matrix4f_t *result); +void BH_Mat4fAdd(const float *a, + const float *b, + float *out); /** - * Subtracts two matricies. + * Subtracts \a a and \a b floating point matricies and stores result into + * \a out. * - * result = a - b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4x4 matrix + * \param b B 4x4 matrix + * \param out Output 4x4 matrix */ -void bh_matrix4f_sub(const bh_matrix4f_t *a, - const bh_matrix4f_t *b, - bh_matrix4f_t *result); +void BH_Mat4fSub(const float *a, + const float *b, + float *out); /** - * Multiplies two matricies. - * - * result = a * b + * Multiplies \a a and \a b floating point matricies and stores result into + * \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 4x4 matrix + * \param b B 4x4 matrix + * \param out Output 4x4 matrix */ -void bh_matrix4f_mul(const bh_matrix4f_t *a, - const bh_matrix4f_t *b, - bh_matrix4f_t *result); +void BH_Mat4fMul(const float *a, + const float *b, + float *out); /** - * Scales the matrix. + * Scales \a a matrix by the value \a b and stores result into \a out. * - * result = a * b - * - * \param a Value - * \param b Factor - * \param result Result + * \param a A 4x4 matrix + * \param b B value + * \param out Output 4x4 matrix */ -void bh_matrix4f_scale(const bh_matrix4f_t *a, - float b, - bh_matrix4f_t *result); +void BH_Mat4fScale(const float *a, + float b, + float *out); /** - * Transposes the matrix. - * - * result = a^T + * Transposes matrix \a in and stores result into \a out. * - * \param in Value - * \param result Result + * \param in Input 4x4 matrix + * \param out Output 4x4 matrix */ -void bh_matrix4f_transpose(const bh_matrix4f_t *in, - bh_matrix4f_t *result); +void BH_Mat4fTranspose(const float *in, + float *out); /** - * Calculates the trace of the matrix. + * Computes \a in matrix trace and returns the result. * - * \param in Value - * - * \return Returns trace value. + * \param in Input 4x4 matrix */ -float bh_matrix4f_trace(const bh_matrix4f_t *in); +float BH_Mat4fTrace(const float *in); /** - * Calculates the determinant of the matrix. - * - * \param in Value + * Computes \a in matrix determinant and returns the result. * - * \return Returns determinant value. + * \param in Input 4x4 matrix */ -float bh_matrix4f_determinant(const bh_matrix4f_t *in); +float BH_Mat4fDet(const float *in); /** - * Calculates the inverse of the matrix. - * - * If matrix has no inverse - identity matrix will be returned. - * - * result = in^-1 + * Computes inverse of \a in matrix and stores result into \a out. * - * \param in Value - * \param result Result + * \param in Input 4x4 matrix + * \param out OUtput 4x4 matrix * - * \return On success, returns inverse of the matrix. - * \return On failure, returns identity matrix. + * \return On success, returns zero. + * \return On failure, returns error code. */ -int bh_matrix4f_inverse(const bh_matrix4f_t *in, - bh_matrix4f_t *result); +int BH_Mat4fInverse(const float *in, + float *out); /** - * Calculates scaling matrix. + * Computes scaling matrix from values \a x, \a y, \a z and stores result into + * \a out. * - * \param x X scale - * \param y Y scale - * \param z Z scale - * \param result Result + * \param x X scale + * \param y Y scale + * \param z Z scale + * \param out Output 4x4 matrix */ -void bh_matrix4f_scaling(float x, - float y, - float z, - bh_matrix4f_t *result); +void BH_Mat4fFromScale(float x, + float y, + float z, + float *out); /** - * Calculates translation matrix. + * Computes translation matrix from values \a x, \a y, \a z and stores result + * into \a out. * - * \param x X scale - * \param y Y scale - * \param z Z scale - * \param result Result + * \param x X translation + * \param y Y translation + * \param z Z translation + * \param out Output 4x4 matrix */ -void bh_matrix4f_translation(float x, +void BH_Mat4fFromTranslation(float x, float y, float z, - bh_matrix4f_t *result); + float *out); /** - * Calculates x-rotation matrix (or rotation around x axis). + * Computes rotation matrix around x axis with angle \a angle and stores + * result \a out. * - * \param angle Angle - * \param result Result + * \param angle Angle + * \param out Output 4x4 matrix */ -void bh_matrix4f_rotation_x(float angle, - bh_matrix4f_t *result); +void BH_Mat4fFromRotationX(float angle, + float *out); /** - * Calculates y-rotation matrix (or rotation around y axis). + * Computes rotation matrix around y axis with angle \a angle and stores + * result \a out. * - * \param angle Angle - * \param result Result + * \param angle Angle + * \param out Output 4x4 matrix */ -void bh_matrix4f_rotation_y(float angle, - bh_matrix4f_t *result); +void BH_Mat4fFromRotationY(float angle, + float *out); /** - * Calculates z-rotation matrix (or rotation around z axis). + * Computes rotation matrix around z axis with angle \a angle and stores + * result \a out. * - * \param angle Angle - * \param result Result + * \param angle Angle + * \param out Output 4x4 matrix */ -void bh_matrix4f_rotation_z(float angle, - bh_matrix4f_t *result); +void BH_Mat4fFromRotationZ(float angle, + float *out); /** - * Calculates rotation matrix around axis. + * Computes rotation matrix around axis \a axis with angle \a angle and stores + * result \a out. * - * \param axis Axis - * \param angle Angle - * \param result Result + * \param axis Axis 3D vector + * \param angle Angle + * \param out Output 4x4 matrix */ -void bh_matrix4f_rotation(const bh_point3f_t *axis, - float angle, - bh_matrix4f_t *result); +void BH_Mat4fFromAxis(const float *axis, + float angle, + float *out); /** - * Calculates rotation matrix from euler angles (roll, pitch, yaw). + * Computes the rotation matrix that represents \a roll, \a pitch, \a yaw (euler + * angles) and stores result into \a out. * - * Order of the rotation is ZYX (yaw, pitch, roll). + * Order of the rotation is ZYX (yaw, pitch, roll) * - * \param roll Roll - * \param pitch Pitch - * \param yaw Yaw - * \param result Result + * \param roll Roll + * \param pitch Pitch + * \param yaw Yaw + * \param out Output 4x4 matrix */ -void bh_matrix4f_rotation_euler(float roll, - float pitch, - float yaw, - bh_matrix4f_t *result); +void BH_Mat4fFromEuler(float roll, + float pitch, + float yaw, + float *out); /** - * Calculates rotation matrix from quaternion. + * Computes 4x4 rotation matrix from quaternion \a in and stores result into + * \a out. * - * \param rotation Quaternion - * \param result Result + * \param in Input quaternion + * \param out Output 4x4 matrix */ -void bh_matrix4f_rotation_quat(bh_quat_t *rotation, - bh_matrix4f_t *result); +void BH_Mat4fFromQuat4f(const float *in, + float *out); /** - * Calculates orthographic projection matrix. + * Computes orthographic projection matrix and stores result into \a out. * - * \param x_min Min x - * \param x_max Max x - * \param y_min Min y - * \param y_max Max y - * \param z_min Min z - * \param z_max Max z - * \param result Result + * \param x_min Min x value + * \param x_max Max x value + * \param y_min Min y value + * \param y_max Max y value + * \param z_min Min z value + * \param z_max Max z value + * \param out Output 4x4 matrix */ -void bh_matrix4f_ortho(float x_min, - float x_max, - float y_min, - float y_max, - float z_min, - float z_max, - bh_matrix4f_t *result); +void BH_Mat4fFromOrtho(float xMin, + float xMax, + float yMin, + float yMax, + float zMin, + float zMax, + float *out); /** - * Calculates perspective projection matrix. + * Computes perspective projection matrix and stores result into \a out. * * \param fov Field of view * \param aspect Aspect ratio - * \param z_min Min z - * \param z_max Max z - * \param result Result + * \param z_min Min z value + * \param z_max Max z value + * \param out Output 4x4 matrix */ -void bh_matrix4f_perspective(float fov, - float aspect, - float z_min, - float z_max, - bh_matrix4f_t *result); +void BH_Mat4fFromFrustum(float fov, + float aspect, + float zMin, + float zMax, + float *out); /** - * Calculates camera view matrix. + * Computes camera view matrix and stores result into \a out. * - * \param camera Position - * \param at Target - * \param up Up - * \param result Result + * \param pos Position vector + * \param at Target vector + * \param up Up vector + * \param out Output 4x4 matrix */ -void bh_matrix4f_lookat(const bh_point3f_t *camera, - const bh_point3f_t *at, - const bh_point3f_t *up, - bh_matrix4f_t *result); +void BH_Mat4fFromLookAt(const float *pos, + const float *at, + const float *up, + float *out); /** - * Applies matrix to vector. + * Multiplies matrix \a a by vector \a b and stores result into \a out. * - * \param a Matrix - * \param b Vector - * \param result Result + * \param a A 4x4 matrix + * \param b B 4D vector + * \param out Output 4D vector */ -void bh_matrix4f_transform_point3f(const bh_matrix4f_t *a, - const bh_point3f_t *b, - bh_point3f_t *result); +void BH_Mat4fApplyVec4f(const float *a, + const float *b, + float *out); /** - * Applies matrix to vector. + * Multiplies matrix \a a by vector \a b and stores result into \a out. * - * \param a Matrix - * \param b Vector - * \param result Result + * \param a A 4x4 matrix + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_matrix4f_transform_point4f(const bh_matrix4f_t *a, - const bh_point4f_t *b, - bh_point4f_t *result); +void BH_Mat4fApplyVec4f(const float *a, + const float *b, + float *out); /** - * Sets matrix to identity. + * Stores identity matrix into \a out. * - * \param result Result + * \param out Output 3x3 matrix. */ -void bh_matrix3f_identity(bh_matrix3f_t *result); +void BH_Mat3fIdentity(float *out); /** - * Adds two matricies. - * - * result = a + b + * Adds \a a and \a b floating point matricies and stores result into \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 3x3 matrix + * \param b B 3x3 matrix + * \param out Output 3x3 matrix */ -void bh_matrix3f_add(const bh_matrix3f_t *a, - const bh_matrix3f_t *b, - bh_matrix3f_t *result); +void BH_Mat3fAdd(const float *a, + const float *b, + float *out); /** - * Subtracts two matricies. + * Subtracts \a a and \a b floating point matricies and stores result into + * \a out. * - * result = a - b - * - * \param a Value - * \param b Value - * \param result Result + * \param a A 3x3 matrix + * \param b B 3x3 matrix + * \param out Output 3x3 matrix */ -void bh_matrix3f_sub(const bh_matrix3f_t *a, - const bh_matrix3f_t *b, - bh_matrix3f_t *result); +void BH_Mat3fSub(const float *a, + const float *b, + float *out); /** - * Multiplies two matricies. - * - * result = a * b + * Multiplies \a a and \a b floating point matricies and stores result into + * \a out. * - * \param a Value - * \param b Value - * \param result Result + * \param a A 3x3 matrix + * \param b B 3x3 matrix + * \param out Output 3x3 matrix */ -void bh_matrix3f_mul(const bh_matrix3f_t *a, - const bh_matrix3f_t *b, - bh_matrix3f_t *result); +void BH_Mat3fMul(const float *a, + const float *b, + float *out); /** - * Scales the matrix. + * Scales \a a matrix by the value \a b and stores result into \a out. * - * result = a * b - * - * \param a Value - * \param b Factor - * \param result Result + * \param a A 3x3 matrix + * \param b B value + * \param out Output 3x3 matrix */ -void bh_matrix3f_scale(const bh_matrix3f_t *a, - float b, - bh_matrix3f_t *result); +void BH_Mat3fScale(const float *a, + float b, + float *out); /** - * Transposes the matrix. - * - * result = a^T + * Transposes matrix \a in and stores result into \a out. * - * \param in Value - * \param result Result + * \param in Input 3x3 matrix + * \param out Output 3x3 matrix */ -void bh_matrix3f_transpose(const bh_matrix3f_t *in, - bh_matrix3f_t *result); +void BH_Mat3fTranspose(const float *in, + float *out); /** - * Calculates the trace of the matrix. + * Computes \a in matrix trace and returns the result. * - * \param in Value - * - * \return Returns trace value. + * \param in Input 3x3 matrix */ -float bh_matrix3f_trace(const bh_matrix3f_t *in); +float BH_Mat3fTrace(const float *in); /** - * Calculates the determinant of the matrix. - * - * \param in Value + * Computes \a in matrix determinant and returns the result. * - * \return Returns determinant value. + * \param in Input 3x3 matrix */ -float bh_matrix3f_determinant(const bh_matrix3f_t *in); +float BH_Mat3fDet(const float *in); /** - * Calculates the inverse of the matrix. + * Computes inverse of \a in matrix and stores result into \a out. * - * If matrix has no inverse - identity matrix will be returned. + * \param in Input 3x3 matrix + * \param out OUtput 3x3 matrix * - * result = in^-1 - * - * \param in Value - * \param result Result - * - * \return On success, returns inverse of the matrix. - * \return On failure, returns identity matrix. + * \return On success, returns zero. + * \return On failure, returns error code. */ -int bh_matrix3f_inverse(const bh_matrix3f_t *in, - bh_matrix3f_t *result); +int BH_Mat3fInverse(const float *in, + float *out); /** - * Calculates scaling matrix. + * Computes scaling matrix from values \a x, \a y and stores result into + * \a out. * - * \param x X scale - * \param y Y scale - * \param z Z scale - * \param result Result + * \param x X scale + * \param y Y scale + * \param out Output 3x3 matrix */ -void bh_matrix3f_scaling(float x, - float y, - bh_matrix3f_t *result); +void BH_Mat3fFromScale(float x, + float y, + float *out); /** - * Calculates translation matrix. + * Computes translation matrix from values \a x, \a y and stores result + * into \a out. * - * \param x X scale - * \param y Y scale - * \param z Z scale - * \param result Result + * \param x X translation + * \param y Y translation + * \param out Output 3x3 matrix */ -void bh_matrix3f_translation(float x, +void BH_Mat3fFromTranslation(float x, float y, - bh_matrix3f_t *result); + float *out); /** - * Calculates rotation matrix. + * Computes rotation matrix around with angle \a angle and stores result \a out. * - * \param angle Angle - * \param result Result + * \param angle Angle + * \param out Output 3x3 matrix */ -void bh_matrix3f_rotation(float angle, - bh_matrix3f_t *result); +void BH_Mat3fFromRotation(float angle, + float *out); /** - * Applies matrix to vector. + * Multiplies matrix \a a by vector \a b and stores result into \a out. * - * \param a Matrix - * \param b Vector - * \param result Result + * \param a A 3x3 matrix + * \param b B 3D vector + * \param out Output 3D vector */ -void bh_matrix3f_transform_point2f(const bh_matrix3f_t *a, - const bh_point2f_t *b, - bh_point2f_t *result); +void BH_Mat3fApplyVec3f(float *a, + float *b, + float *out); /** - * Applies matrix to vector. + * Multiplies matrix \a a by vector \a b and stores result into \a out. * - * \param a Matrix - * \param b Vector - * \param result Result + * \param a A 3x3 matrix + * \param b B 2D vector + * \param out Output 2D vector */ -void bh_matrix3f_transform_point3f(const bh_matrix3f_t *a, - const bh_point3f_t *b, - bh_point3f_t *result); +void BH_Mat3fApplyVec2f(float *a, + float *b, + float *out); #endif /* BH_MATH_H */ diff --git a/include/bh/queue.h b/include/bh/queue.h index 7905c77..f7b8b12 100755 --- a/include/bh/queue.h +++ b/include/bh/queue.h @@ -5,7 +5,7 @@ #include "common.h" -typedef struct bh_queue_s bh_queue_t; +typedef struct BH_Queue BH_Queue; /** @@ -14,7 +14,7 @@ typedef struct bh_queue_s bh_queue_t; * \return On success, returns the pointer to the new queue object. * \return On failure, returns a null pointer. */ -bh_queue_t *bh_queue_new(void); +BH_Queue *BH_QueueNew(void); /** @@ -22,7 +22,7 @@ bh_queue_t *bh_queue_new(void); * * \param queue Pointer to the queue object to be freed */ -void bh_queue_free(bh_queue_t *queue); +void BH_QueueFree(BH_Queue *queue); /** @@ -30,7 +30,7 @@ void bh_queue_free(bh_queue_t *queue); * * \param queue Pointer to the queue object to be cleared */ -void bh_queue_clear(bh_queue_t *queue); +void BH_QueueClear(BH_Queue *queue); /** @@ -47,8 +47,8 @@ void bh_queue_clear(bh_queue_t *queue); * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_queue_reserve(bh_queue_t *queue, - size_t size); +int BH_QueueReserve(BH_Queue *queue, + size_t size); /** @@ -62,8 +62,8 @@ int bh_queue_reserve(bh_queue_t *queue, * \return On success, returns zero value. * \return On failure, returns error code. */ -int bh_queue_insert(bh_queue_t *queue, - void *value); +int BH_QueueInsert(BH_Queue *queue, + void *value); /** @@ -73,7 +73,7 @@ int bh_queue_insert(bh_queue_t *queue, * * \note Calling this function will invalidate iterators. */ -void bh_queue_remove(bh_queue_t *queue); +void BH_QueueRemove(BH_Queue *queue); /** @@ -84,8 +84,8 @@ void bh_queue_remove(bh_queue_t *queue); * \return On success, returns front value from the queue. * \return On failure, returns null pointer. */ -int bh_queue_front(bh_queue_t *queue, - void **value); +int BH_QueueFront(BH_Queue *queue, + void **value); /** @@ -96,7 +96,7 @@ int bh_queue_front(bh_queue_t *queue, * \return If queue is empty, returns non-zero value * \return If queue is not empty, returns zero value */ -int bh_queue_empty(bh_queue_t *queue); +int BH_QueueEmpty(BH_Queue *queue); /** @@ -106,7 +106,7 @@ int bh_queue_empty(bh_queue_t *queue); * * \return Returns the size of the queue. */ -size_t bh_queue_size(bh_queue_t *queue); +size_t BH_QueueSize(BH_Queue *queue); /** @@ -116,7 +116,7 @@ size_t bh_queue_size(bh_queue_t *queue); * * \return Returns the capacity of the queue. */ -size_t bh_queue_capacity(bh_queue_t *queue); +size_t BH_QueueCapacity(BH_Queue *queue); /** @@ -132,8 +132,8 @@ size_t bh_queue_capacity(bh_queue_t *queue); * \return If the \a iter is the null pointer, returns iterator to the * first element of the queue. */ -void *bh_queue_iter_next(bh_queue_t *queue, - void *iter); +void *BH_QueueIterNext(BH_Queue *queue, + void *iter); /** @@ -143,7 +143,7 @@ void *bh_queue_iter_next(bh_queue_t *queue, * * \return Returns value, pointed by iterator. */ -void *bh_queue_iter_value(void *iter); +void *BH_QueueIterValue(void *iter); #endif /* BH_QUEUE_H */ |
