Author Topic: Fixed Point Maths Library now Cross-Platform  (Read 3057 times)

flatmush (OP)

  • Posts: 288
Fixed Point Maths Library now Cross-Platform
« on: February 14, 2011, 09:38:28 pm »
I have branched all the fixed point maths stuff from the Native SDK to make a cross-platform library. It should work on all platforms since it's only requirements are 32-bit 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 open-source 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 :)

Poligrafowicz

  • Posts: 213
Re: Fixed Point Maths Library now Cross-Platform
« Reply #1 on: February 15, 2011, 08:36:15 am »
I wonder if its possible to replace TinGL's float arithmetic with this(at least partially)...

flatmush (OP)

  • Posts: 288
Re: Fixed Point Maths Library now Cross-Platform
« Reply #2 on: February 15, 2011, 06:44:18 pm »
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.

RodrigoCard

  • Posts: 314
    • Mac Joystick Apps
Re: Fixed Point Maths Library now Cross-Platform
« Reply #3 on: March 01, 2011, 02:52:02 am »
nice! I was looking for something like this =)

 

Post a new topic
Post a new topic