rsys

Basic data structures and low-level features
git clone git://git.meso-star.fr/rsys.git
Log | Files | Refs | README | LICENSE

commit 92c2d902582f97b08062c5eaae5d089a3fd595e8
parent ac1e83faf1e5bf266988b4417f80c5836c415325
Author: vaplv <vaplv@free.fr>
Date:   Thu,  9 May 2019 11:22:55 +0200

Merge branch 'release_0.8'

Diffstat:
MREADME.md | 14+++++++++++++-
Mcmake/CMakeLists.txt | 8++++----
Msrc/algorithm.h | 2+-
Msrc/binary_heap.h | 2+-
Msrc/clock_time.c | 2+-
Msrc/clock_time.h | 2+-
Msrc/condition.h | 2+-
Msrc/cstr.c | 2+-
Msrc/cstr.h | 2+-
Msrc/cstr_to_list.h | 2+-
Msrc/double2.h | 2+-
Msrc/double22.h | 2+-
Msrc/double3.h | 2+-
Msrc/double33.h | 2+-
Msrc/double4.h | 2+-
Msrc/double44.h | 2+-
Msrc/dynamic_array.h | 32+++++++++++++++++---------------
Msrc/dynamic_array_char.h | 2+-
Msrc/dynamic_array_double.h | 2+-
Msrc/dynamic_array_float.h | 2+-
Msrc/dynamic_array_int.h | 2+-
Msrc/dynamic_array_size_t.h | 2+-
Msrc/dynamic_array_str.h | 2+-
Msrc/dynamic_array_u32.h | 2+-
Msrc/dynamic_array_u64.h | 2+-
Msrc/dynamic_array_uchar.h | 2+-
Msrc/dynamic_array_uint.h | 2+-
Msrc/float2.h | 2+-
Msrc/float22.h | 2+-
Msrc/float3.h | 2+-
Msrc/float33.h | 2+-
Msrc/float4.h | 2+-
Msrc/float44.h | 2+-
Msrc/free_list.h | 2+-
Msrc/hash.h | 2+-
Msrc/hash_table.h | 4++--
Msrc/image.c | 2+-
Msrc/image.h | 2+-
Msrc/io_c99.h | 2+-
Msrc/library.c | 2+-
Msrc/library.h | 2+-
Msrc/list.h | 2+-
Msrc/logger.c | 2+-
Msrc/logger.h | 2+-
Msrc/math.h | 2+-
Msrc/mem_allocator.c | 2+-
Msrc/mem_allocator.h | 2+-
Msrc/mem_lifo_allocator.c | 2+-
Msrc/mem_proxy_allocator.c | 2+-
Msrc/mutex.h | 2+-
Msrc/pthread/pthread_condition.c | 2+-
Msrc/pthread/pthread_mutex.c | 2+-
Msrc/quaternion.c | 2+-
Msrc/quaternion.h | 2+-
Msrc/real2.h | 2+-
Msrc/real22.h | 14+++++++++++++-
Msrc/real3.h | 2+-
Msrc/real33.h | 2+-
Msrc/real44.h | 2+-
Msrc/realX.h | 2+-
Msrc/realXY.h | 2+-
Msrc/realXY_begin.h | 2+-
Msrc/realXY_end.h | 2+-
Msrc/realX_begin.h | 2+-
Msrc/realX_end.h | 2+-
Msrc/ref_count.h | 2+-
Msrc/rsys.h | 2+-
Msrc/signal.h | 2+-
Msrc/str.c | 2+-
Msrc/str.h | 2+-
Msrc/stretchy_array.h | 2+-
Msrc/test_algorithm.c | 2+-
Msrc/test_atomic.c | 2+-
Msrc/test_binary_heap.c | 2+-
Msrc/test_condition.c | 2+-
Msrc/test_cstr.c | 2+-
Msrc/test_double2.c | 2+-
Msrc/test_double22.c | 2+-
Msrc/test_double3.c | 2+-
Msrc/test_double33.c | 2+-
Msrc/test_double4.c | 2+-
Msrc/test_double44.c | 2+-
Msrc/test_dynamic_array.c | 84++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Msrc/test_float2.c | 2+-
Msrc/test_float22.c | 2+-
Msrc/test_float3.c | 2+-
Msrc/test_float33.c | 2+-
Msrc/test_float4.c | 2+-
Msrc/test_float44.c | 2+-
Msrc/test_free_list.c | 2+-
Msrc/test_func_name.c | 2+-
Msrc/test_hash_table.c | 2+-
Msrc/test_image.c | 2+-
Msrc/test_library.c | 2+-
Msrc/test_list.c | 2+-
Msrc/test_logger.c | 2+-
Msrc/test_math.c | 2+-
Msrc/test_mem_allocator.c | 2+-
Msrc/test_misc.c | 2+-
Msrc/test_mutex.c | 2+-
Msrc/test_quaternion.c | 2+-
Msrc/test_real2.h | 2+-
Msrc/test_real22.h | 26+++++++++++++++++++++++++-
Msrc/test_real3.h | 2+-
Msrc/test_real33.h | 2+-
Msrc/test_real4.h | 2+-
Msrc/test_real44.h | 2+-
Msrc/test_ref.c | 2+-
Msrc/test_signal.c | 2+-
Msrc/test_str.c | 2+-
Msrc/test_time.c | 2+-
Msrc/win32/win32_condition.c | 2+-
Msrc/win32/win32_mutex.c | 2+-
113 files changed, 263 insertions(+), 131 deletions(-)

diff --git a/README.md b/README.md @@ -17,6 +17,18 @@ project can be now edited, built, tested and installed as any CMake project. ## Release notes +### Version 0.8 + +- Update the allocation policy of the dynamic arrays: the `reserve` and + `resize` functions strictly allocate the submitted size if there is no + sufficient space already allocated. +- Add the `DARRAY_BUF` macro: give a direct access to the internal buffer of + the dynamic array. It is a less verbose alternative to the `data_get` and + `cdata_get` dynamic array functions that operate on strongly typed data + structures. +- Add the `d22_rotation` and `f22_rotation` functions: compute a 2x2 rotation + matrix in the XY plane. + ### Version 0.7.1 - Add the FALLTHROUGH macro that disables compilation warning on switch @@ -73,7 +85,7 @@ project can be now edited, built, tested and installed as any CMake project. ## License -RSys is Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr). It is a free +RSys is Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr). It is a free software released under LGPL v3+ license. You are welcome to redistribute it under certain conditions; refer to the COPYING files for details. diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +# Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) # # This CMake script is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -38,8 +38,8 @@ include(rcmake) # Configure and define targets ################################################################################ set(VERSION_MAJOR 0) -set(VERSION_MINOR 7) -set(VERSION_PATCH 1) +set(VERSION_MINOR 8) +set(VERSION_PATCH 0) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(RSYS_FILES_SRC @@ -211,7 +211,7 @@ if(NOT NO_TEST) new_test(test_float2 ${MATH_LIB}) new_test(test_float3 ${MATH_LIB}) new_test(test_float4 ${MATH_LIB}) - new_test(test_float22) + new_test(test_float22 ${MATH_LIB}) new_test(test_float33 ${MATH_LIB}) new_test(test_float44) new_test(test_free_list rsys) diff --git a/src/algorithm.h b/src/algorithm.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/binary_heap.h b/src/binary_heap.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/clock_time.c b/src/clock_time.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/clock_time.h b/src/clock_time.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/condition.h b/src/condition.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/cstr.c b/src/cstr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/cstr.h b/src/cstr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/cstr_to_list.h b/src/cstr_to_list.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/double2.h b/src/double2.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/double22.h b/src/double22.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/double3.h b/src/double3.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/double33.h b/src/double33.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/double4.h b/src/double4.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/double44.h b/src/double44.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/dynamic_array.h b/src/dynamic_array.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -22,6 +22,9 @@ #include "rsys.h" #include <string.h> +/* Helper macro to quickly access darray internal buffer */ +#define DARRAY_BUF(Darray) (Darray)->data + #endif /* DYNAMIC_ARRAY_H */ #else /* @@ -157,19 +160,14 @@ static INLINE res_T DARRAY_FUNC__(reserve)(struct DARRAY_TYPE__* darray, const size_t sz) { DARRAY_DATA* data = NULL; - size_t sz_adjusted; ASSERT(darray); if(sz <= darray->capacity) return RES_OK; - sz_adjusted = round_up_pow2(sz); data = (DARRAY_DATA*)MEM_ALLOC_ALIGNED - (darray->allocator, - sz_adjusted * sizeof(DARRAY_DATA), - DARRAY_ALIGNMENT__); - if(!data) - return RES_MEM_ERR; + (darray->allocator, sz * sizeof(DARRAY_DATA), DARRAY_ALIGNMENT__); + if(!data) return RES_MEM_ERR; if(darray->size) { size_t i = 0; @@ -186,7 +184,7 @@ DARRAY_FUNC__(reserve)(struct DARRAY_TYPE__* darray, const size_t sz) MEM_RM(darray->allocator, darray->data); darray->data = data; - darray->capacity = sz_adjusted; + darray->capacity = sz; return RES_OK; } @@ -217,14 +215,18 @@ DARRAY_FUNC__(push_back) (struct DARRAY_TYPE__* darray, DARRAY_DATA const* data) { - size_t sz = 0; + DARRAY_DATA* dst; + size_t sz_adjusted; res_T res; ASSERT(darray && data); - sz = darray->size; - res = DARRAY_FUNC__(resize)(darray, sz+1); - if(res != RES_OK) - return res; - DARRAY_FUNCTOR_COPY(darray->data+sz, data); + + sz_adjusted = round_up_pow2(darray->size + 1); + res = DARRAY_FUNC__(reserve)(darray, sz_adjusted); + if(res != RES_OK) return res; + dst = darray->data + darray->size; + DARRAY_FUNCTOR_INIT(darray->allocator, dst); + DARRAY_FUNCTOR_COPY(dst, data); + ++darray->size; return RES_OK; } diff --git a/src/dynamic_array_char.h b/src/dynamic_array_char.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/dynamic_array_double.h b/src/dynamic_array_double.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/dynamic_array_float.h b/src/dynamic_array_float.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/dynamic_array_int.h b/src/dynamic_array_int.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/dynamic_array_size_t.h b/src/dynamic_array_size_t.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/dynamic_array_str.h b/src/dynamic_array_str.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/dynamic_array_u32.h b/src/dynamic_array_u32.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/dynamic_array_u64.h b/src/dynamic_array_u64.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/dynamic_array_uchar.h b/src/dynamic_array_uchar.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/dynamic_array_uint.h b/src/dynamic_array_uint.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/float2.h b/src/float2.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/float22.h b/src/float22.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/float3.h b/src/float3.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/float33.h b/src/float33.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/float4.h b/src/float4.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/float44.h b/src/float44.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/free_list.h b/src/free_list.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/hash.h b/src/hash.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/hash_table.h b/src/hash_table.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -34,7 +34,7 @@ * - HTABLE_DATA: type of the data registered into the hash table; * - HTABLE_KEY: type of the key indexing the hash table data; * - HTABLE_KEY_FUNCTOR_HASH: hash functor on HTABLE_KEY. If not defined, use - * the default function that hashes the bytes of HTABLE_KEY; + * the default function that hashes the bytes of HTABLE_KEY; * - HTABLE_KEY_FUNCTOR_EQ: equality functor on 2 HTABLE_KEY; * - HTABLE_<DATA|KEY>_FUNCTOR_INIT: init functor on HTABLE_<DATA|KEY>. If not * defined, no specific treatment is performed on the created data; diff --git a/src/image.c b/src/image.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/image.h b/src/image.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/io_c99.h b/src/io_c99.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/library.c b/src/library.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/library.h b/src/library.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/list.h b/src/list.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/logger.c b/src/logger.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/logger.h b/src/logger.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/math.h b/src/math.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/mem_allocator.c b/src/mem_allocator.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/mem_allocator.h b/src/mem_allocator.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/mem_lifo_allocator.c b/src/mem_lifo_allocator.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/mem_proxy_allocator.c b/src/mem_proxy_allocator.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/mutex.h b/src/mutex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/pthread/pthread_condition.c b/src/pthread/pthread_condition.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/pthread/pthread_mutex.c b/src/pthread/pthread_mutex.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/quaternion.c b/src/quaternion.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/quaternion.h b/src/quaternion.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/real2.h b/src/real2.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/real22.h b/src/real22.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -71,5 +71,17 @@ REALXY_FUNC__(invtrans)(REAL_TYPE__* dst, const REAL_TYPE__* mat) return det; } +static FINLINE REAL_TYPE__* +REALXY_FUNC__(rotation) + (REAL_TYPE__ dst[4], const REAL_TYPE__ angle/*in radian*/) +{ + const REAL_TYPE__ c = (REAL_TYPE__)cos((double)angle); + const REAL_TYPE__ s = (REAL_TYPE__)sin((double)angle); + ASSERT(dst); + dst[0] = c; dst[1] = s; + dst[2] =-s; dst[3] = c; + return dst; +} + #include "realXY_end.h" diff --git a/src/real3.h b/src/real3.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/real33.h b/src/real33.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/real44.h b/src/real44.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/realX.h b/src/realX.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/realXY.h b/src/realXY.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/realXY_begin.h b/src/realXY_begin.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/realXY_end.h b/src/realXY_end.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/realX_begin.h b/src/realX_begin.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/realX_end.h b/src/realX_end.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/ref_count.h b/src/ref_count.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/rsys.h b/src/rsys.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/signal.h b/src/signal.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/str.c b/src/str.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/str.h b/src/str.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/stretchy_array.h b/src/stretchy_array.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_algorithm.c b/src/test_algorithm.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_atomic.c b/src/test_atomic.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_binary_heap.c b/src/test_binary_heap.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_condition.c b/src/test_condition.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_cstr.c b/src/test_cstr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_double2.c b/src/test_double2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_double22.c b/src/test_double22.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_double3.c b/src/test_double3.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_double33.c b/src/test_double33.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_double4.c b/src/test_double4.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_double44.c b/src/test_double44.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_dynamic_array.c b/src/test_dynamic_array.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -73,7 +73,11 @@ test_cstr(struct mem_allocator* allocator) darray_str_push_back(&darray, strs + i); } FOR_EACH(i, 0, nstrs) { + CHK(DARRAY_BUF(&darray) == darray_str_cdata_get(&darray)); + CHK(DARRAY_BUF(&darray) == darray_str_data_get(&darray)); + CHK(DARRAY_BUF((struct darray_str*)(&darray)) == DARRAY_BUF(&darray)); CHK(strcmp(darray_str_cdata_get(&darray)[i], strs[i]) == 0); + CHK(strcmp(DARRAY_BUF(&darray)[i], strs[i]) == 0); } darray_str_purge(&darray); CHK(darray_str_size_get(&darray) == 0); @@ -358,6 +362,83 @@ test_alignment(struct mem_allocator* allocator) darray_byte1K_release(&bytes1K); } +static void +test_allocation_policy(struct mem_allocator* allocator) +{ + struct darray_int integers; + const int* mem; + int i; + + darray_int_init(allocator, &integers); + CHK(darray_int_capacity(&integers) == 0); + + CHK(darray_int_reserve(&integers, 33) == RES_OK); + CHK(darray_int_capacity(&integers) == 33); + CHK(darray_int_size_get(&integers) == 0); + mem = darray_int_cdata_get(&integers); + + CHK(darray_int_resize(&integers, 14) == RES_OK); + CHK(darray_int_capacity(&integers) == 33); + CHK(darray_int_size_get(&integers) == 14); + CHK(darray_int_cdata_get(&integers) == mem); + + darray_int_clear(&integers); + CHK(darray_int_capacity(&integers) == 33); + CHK(darray_int_size_get(&integers) == 0); + CHK(darray_int_cdata_get(&integers) == mem); + + CHK(darray_int_resize(&integers, 35) == RES_OK); + CHK(darray_int_capacity(&integers) == 35); + CHK(darray_int_size_get(&integers) == 35); + CHK(darray_int_cdata_get(&integers) != mem); + + darray_int_purge(&integers); + CHK(darray_int_capacity(&integers) == 0); + CHK(darray_int_size_get(&integers) == 0); + + i = 0; + CHK(darray_int_push_back(&integers, &i) == RES_OK); + CHK(darray_int_capacity(&integers) == 1); + CHK(darray_int_size_get(&integers) == 1); + mem = darray_int_cdata_get(&integers); + + CHK(darray_int_push_back(&integers, &i) == RES_OK); + CHK(darray_int_capacity(&integers) == 2); + CHK(darray_int_size_get(&integers) == 2); + CHK(darray_int_cdata_get(&integers) != mem); + mem = darray_int_cdata_get(&integers); + + CHK(darray_int_push_back(&integers, &i) == RES_OK); + CHK(darray_int_capacity(&integers) == 4); + CHK(darray_int_size_get(&integers) == 3); + CHK(darray_int_cdata_get(&integers) != mem); + mem = darray_int_cdata_get(&integers); + + CHK(darray_int_push_back(&integers, &i) == RES_OK); + CHK(darray_int_capacity(&integers) == 4); + CHK(darray_int_size_get(&integers) == 4); + CHK(darray_int_cdata_get(&integers) == mem); + + CHK(darray_int_push_back(&integers, &i) == RES_OK); + CHK(darray_int_capacity(&integers) == 8); + CHK(darray_int_size_get(&integers) == 5); + CHK(darray_int_cdata_get(&integers) != mem); + mem = darray_int_cdata_get(&integers); + + darray_int_purge(&integers); + CHK(darray_int_capacity(&integers) == 0); + CHK(darray_int_size_get(&integers) == 0); + CHK(darray_int_cdata_get(&integers) == NULL); + + FOR_EACH(i, 0, 33) { + CHK(darray_int_push_back(&integers, &i) == RES_OK); + } + CHK(darray_int_capacity(&integers) == 64); + CHK(darray_int_size_get(&integers) == 33); + + darray_int_release(&integers); +} + int main(int argc, char** argv) { @@ -378,6 +459,7 @@ main(int argc, char** argv) test_swap_string(&allocator_proxy, &allocator_proxy); test_alignment(&mem_default_allocator); + test_allocation_policy(&mem_default_allocator); check_memory_allocator(&allocator_proxy); mem_shutdown_proxy_allocator(&allocator_proxy); diff --git a/src/test_float2.c b/src/test_float2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_float22.c b/src/test_float22.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_float3.c b/src/test_float3.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_float33.c b/src/test_float33.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_float4.c b/src/test_float4.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_float44.c b/src/test_float44.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_free_list.c b/src/test_free_list.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_func_name.c b/src/test_func_name.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_hash_table.c b/src/test_hash_table.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_image.c b/src/test_image.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_library.c b/src/test_library.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_list.c b/src/test_list.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_logger.c b/src/test_logger.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_math.c b/src/test_math.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_mem_allocator.c b/src/test_mem_allocator.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_misc.c b/src/test_misc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_mutex.c b/src/test_mutex.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_quaternion.c b/src/test_quaternion.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_real2.h b/src/test_real2.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_real22.h b/src/test_real22.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -161,6 +161,30 @@ main(int argc, char** argv) CHK(REALXY_FUNC__(invtrans)(a, a) == -2.0); CHECK_REAL22(a, REALXY_CTOR__(c, -2.0, 1.0, 1.5, -0.5)); + CHK(REALXY_FUNC__(rotation)(c, (REAL_TYPE__)PI/4) == c); + + REALX_CTOR__(a, 1, 0); + CHK(REALXY_REALX_FUNC__(mul)(a, c, a) == a); + REALX_FUNC__(splat)(c, (REAL_TYPE__)(sqrt(2.0)/2.0)); + CHK(REALX_FUNC__(eq_eps)(a, c, (REAL_TYPE__)1.e-6)); + + REALX_CTOR__(b, 0, -1); + CHK(REALXY_REALX_FUNC__(mul)(b, c, b) == b); + REALX_CTOR__(c, (REAL_TYPE__)(sqrt(2.0)/2.0), -(REAL_TYPE__)(sqrt(2.0)/2.0)); + CHK(REALX_FUNC__(eq_eps)(b, c, (REAL_TYPE__)1.e-6)); + + CHK(REALXY_FUNC__(rotation)(c, -(REAL_TYPE__)PI/2) == c); + + REALX_CTOR__(a, 1, 0); + CHK(REALXY_REALX_FUNC__(mul)(a, c, a) == a); + REALX_CTOR__(c, 0, -1); + CHK(REALX_FUNC__(eq_eps)(a, c, (REAL_TYPE__)1.e-6)); + + REALX_CTOR__(b, 0, -1); + CHK(REALXY_REALX_FUNC__(mul)(b, c, b) == b); + REALX_CTOR__(c, -1, 0); + CHK(REALX_FUNC__(eq_eps)(b, c, (REAL_TYPE__)1.e-6)); + return 0; } diff --git a/src/test_real3.h b/src/test_real3.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_real33.h b/src/test_real33.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_real4.h b/src/test_real4.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_real44.h b/src/test_real44.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_ref.c b/src/test_ref.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_signal.c b/src/test_signal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_str.c b/src/test_str.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/test_time.c b/src/test_time.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/win32/win32_condition.c b/src/win32/win32_condition.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/win32/win32_mutex.c b/src/win32/win32_mutex.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2018 Vincent Forest (vaplv@free.fr) +/* Copyright (C) 2013-2019 Vincent Forest (vaplv@free.fr) * * The RSys library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published