Dingoonity.org
Dingux (Dingoo Linux) => Development => Topic started by: flatmush on February 14, 2011, 09:38:28 pm

I have branched all the fixed point maths stuff from the Native SDK to make a crossplatform library. It should work on all platforms since it's only requirements are 32bit arithmetic (64 for multiplication) and <stdint.h>.
It's been tested and worked flawlessly on Win32, Linux x86 and the Dingoo with no compile warnings.
It is currently used widely throughout FGL (my unreleased fixed point graphics library) for transformations, so it is fairly well optimized. It is also used for all the maths in AstroLander.
As a quick overview, it provides the following functions:
Mul/Div: mul, div, lerp16
Saturated Arithmetic: sadd, smul, sdiv
Trigonometry: sin, cos, tan, asin, acos, atan, atan2
Misc.: sqrt, log2
This is as always and opensource project and the project page can be found here:
http://code.google.com/p/libfixmath
Hope some of you find this useful. See, us native types aren't pure evil :)

I wonder if its possible to replace TinGL's float arithmetic with this(at least partially)...

Should be, since it's only the transformations that are done in float (or it should be). In FGL (which I will release at some point soon) all the transformations are done using fixed point and the rendering is all integer maths.
If it's modular enough then it should be a trivial rewrite of the transformation functions, but having never looked into it I can't promise anything like that.

nice! I was looking for something like this =)