Commit Graph

137 Commits

Author SHA1 Message Date
Martin Bařinka 0c88e55fa8
fixed division, undefined behaviors and some improvements (#33)
* testing using ctest

* emove old testing script

* added github workflow CI

* updated CI

* added unit test for macros

* F16() and F16C() are both rounding allways, so fix16_from_dbl should as well

* added tests for strign operations, but these functions are in my opinion unreliable and tests are failing

* removed old unittests

* removed old unittests from cmake

* problem with division using gcc

* improved benchmark

* clarification of problem with division

* attempt to fix

* fixed some undefined behaviors, fixed division
2021-05-03 13:43:54 +03:00
Martin Bařinka 4ea8f3ff12
Unit testing with cmake (#31)
* testing using ctest

* emove old testing script

* added github workflow CI

* updated CI
2021-04-29 13:38:21 +03:00
Martin Bařinka 799ecab03d
better unittest script (#30) 2021-04-29 13:09:56 +03:00
Petteri Aimonen 19e5ec621e
Make unittest #include path consistent (#29) 2021-04-29 10:02:02 +03:00
Petteri Aimonen 9b701e574b Enable Travis CI 2021-04-29 09:55:42 +03:00
Petteri Aimonen c4a480774a Fix compiler warning in fix16_abs() 2021-04-29 09:50:32 +03:00
Martin Bařinka 35eb7753d2
New unittests (#28)
Refactor unittests
2021-04-29 09:40:06 +03:00
Petteri Aimonen 951f522b13
Merge pull request #26 from maruncz/hotfix/abs-signed-overflow
signed integer overflow is undefined behavior
2021-04-27 12:32:08 +03:00
maruncz ba0991de3e fixed: signed integer overflow is undefined behavior 2021-04-27 11:08:33 +02:00
Petteri Aimonen b20bdb01d9
Merge pull request #25 from maruncz/master
Added CMakeLists.txt and some fixes
2021-04-22 11:04:01 +03:00
maruncz 17a6197819 fix formatting 2021-04-22 09:10:50 +02:00
maruncz edcfdea949 fixed some warnings 2021-04-21 15:08:15 +02:00
maruncz 7541eae325 added cmake project file 2021-04-19 10:46:15 +02:00
Petteri Aimonen 24488b16cc
Merge pull request #23 from theacodes/patch-1
Add LICENSE
2021-01-23 11:56:48 +02:00
Thea Flowers 9a5a33c8cb Add AUTHORS file 2021-01-22 14:26:00 -05:00
Stargirl Flowers 579f60511f
Add LICENSE
This library is wonderful, however, it's missing an explicit license in its source code. This adds the text of the MIT license along with the name of the original author. This helps folks like me make sure we follow the license terms when using this library. :)
2021-01-21 15:26:19 -05:00
Petteri Aimonen 83c5f4438e
Merge pull request #21 from HamAndChris/fix_linear_interpolation
Removed 64-bit restriction on linear interpolation functions, fixed int64 bugs
2020-10-29 21:23:07 +02:00
Chris Hammond 18a9ad00de Removed 64-bit restriction on linear interpolation functions. Added more test cases and fixed several bugs in the 64-bit arithmetic functions.
Also added script to run all unit tests.
2020-10-29 13:20:27 -04:00
Petteri Aimonen 54c1f9276a
Merge pull request #20 from HamAndChris/fix_linear_interpolation
Fix type conversion bugs in linear interpolation functions
2020-10-23 08:22:13 +03:00
Chris Hammond 2859cbf31d Added unit tests for "lerp" functions, and found several type conversion bugs 2020-10-22 16:24:49 -04:00
Petteri Aimonen 66365d5888
Merge pull request #16 from althonos/patch-1
Fix GCC error when compiling in no-overflow mode
2020-03-15 06:53:22 +02:00
Martin Larralde 950d51759b
Fix `elif` without condition in `fix16_trig.c` 2020-03-15 02:22:25 +01:00
Petteri Aimonen 20a2d64bb8
Merge pull request #15 from dlech/patch-1
add #include <stdint.h> to int64.h
2019-12-13 08:17:21 +02:00
David Lechner d09f7a4396
add #include <stdint.h> to int64.h
When using the `gcc -M` option to determine header file dependencies, int64.h causes an error because the types from stdint.h are not defined.
2019-12-12 17:02:53 -06:00
Petteri Aimonen c3017d7d74
Merge pull request #13 from althonos/patch-1
Fix missing function when building without overflow support
2019-09-08 21:35:57 +03:00
Martin Larralde 6f6284807f
Fix missing function when building without overflow support 2019-09-08 15:28:05 +02:00
Petteri Aimonen fd01d546a9
Merge pull request #12 from dlech/master
Fixes
2019-06-17 09:17:19 +03:00
David Lechner 11855068c3 Fix conflict with __int64_t typedef
On Linux, we get a compile error because __int64_t is defined and
included by stdint.h. Double underscores are reseved in C in general
and should not be used anyway. Replace with a single leading underscore.
2019-06-16 15:38:23 -05:00
David Lechner ff0a5f69c2 add FIXMATH_NO_CTYPE option
When compiling with -nostdlib, the functions in ctype may not be
available. Add FIXMATH_NO_CTYPE option to replace them with inline
functions.

Also add unit test to test str functions with this option enabled.
2019-06-16 15:38:19 -05:00
David Lechner 108fd93a34 clean all unit tests
make clean should delete all unit test binary files
2019-06-16 15:37:41 -05:00
David Lechner 3b7f96f982 Add explicit cast in fix16_from_dbl()
This fixes the error:

    implicit conversion from 'float' to 'double' to match other operand
    of binary expression

When the compiler options -fsingle-precision-constant -Wdouble-promotion
are set
2019-06-16 15:19:01 -05:00
Petteri Aimonen 47a5aa74ff
Merge pull request #10 from puzrin/patch-1
Suppress `-Wconversion` warning
2019-04-15 09:14:33 +03:00
Vitaly Puzrin f13c322287
Suppress `-Wconversion` warning 2019-04-15 02:29:08 +03:00
Petteri Aimonen bada934981
Merge pull request #9 from puzrin/patch-1
platformio: drop 'export' option from config
2018-07-27 15:53:53 +03:00
Vitaly Puzrin f1d95c94df
platformio: drop 'export' option from config
Library should be useable from pio both by direct git link and by name.
2018-07-27 14:54:22 +03:00
Petteri Aimonen 7dbe4b984b
Merge pull request #8 from puzrin/master
Update pio manifest to satisfy registry add rules
2018-07-24 15:06:30 +03:00
Vitaly Puzrin c0e66997db
Update pio manifest to satisfy registry add rules 2018-07-24 14:59:00 +03:00
Petteri Aimonen dd8da476c7
Merge pull request #6 from puzrin/master
Add library config for PlatformIO
2018-07-24 14:16:02 +03:00
Vitaly Puzrin ad66a42562 Add library config for PlatformIO 2018-07-24 14:00:19 +03:00
Petteri Aimonen 7f9c966b5c Merge pull request #4 from cladmi/pr/libfixmath/gcc6
Fix '-Werror=shift-negative-value' for gcc 6
2017-09-28 18:58:34 +03:00
Gaëtan Harter f8596fbada Fix '-Werror=shift-negative-value' for gcc 6
GCC 6 introduced warning for shift on negative value numbers.
When F16C is called with a negative number it evaluates FIXMATH_COMBINE_I_M
with both the positive and the negative value.

Fixes #3
2017-09-28 17:06:54 +02:00
Petteri Aimonen 6928e2f76d Merge pull request #2 from xli2012/const
make some member functions const
2017-08-09 07:15:28 +03:00
Xin Li a2784ee999 make some member functions const 2017-08-08 13:54:48 -07:00
Petteri Aimonen ad9ed940e5 Add license info, as originally on Google Code. 2015-07-07 10:41:09 +03:00
Petteri Aimonen 6d4ced1f8f Create README.md 2015-07-07 10:38:13 +03:00
PetteriAimonen cbbfe85a4a Add F16C() macro for defining values without float support.
Implementation by Jonas Zeiger.
2014-12-30 18:41:55 +00:00
PetteriAimonen 516f37428b Fix typo in benchmark.c. 2014-12-30 18:41:00 +00:00
PetteriAimonen bffee79f7f Fix compile error on GCC 2014-01-16 19:15:34 +00:00
PetteriAimonen 6758096516 Fix errors on Visual Studio (patch by sunside227) 2014-01-16 06:21:59 +00:00
PetteriAimonen 66dcaddf68 Fix bug in fix16_str_unittests on Windows.
Fixes issue 23.
2013-04-19 19:36:49 +00:00