libfixmath | Cross Platform Fixed Point Maths Library
kandi X-RAY | libfixmath Summary
kandi X-RAY | libfixmath Summary
This is a mirror of the libfixmath's original SVN repository on Google Code. Libfixmath implements Q16.16 format fixed point operations in C.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of libfixmath
libfixmath Key Features
libfixmath Examples and Code Snippets
Community Discussions
Trending Discussions on libfixmath
QUESTION
In libfixmath there is the following macro magic:
...ANSWER
Answered 2020-Nov-16 at 13:42According to godbolt, it works in gcc 8.2 but fails in 7.3.
However, if you replace ( #i[0] ) == '-')
with (i) < 0
, then it works in lower versions too.
I find it weird that the author of this library chose to use ( #i[0] ) == '-')
to test if the macro argument is negative, since it will fail if the parameter is not an integer literal.
(Update) According to OP's comment, the reason why (i) < 0
cannot be used is that it needs to classify -0
as negative too.
Here are some different approaches for GCC:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install libfixmath
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page