Coder Social home page Coder Social logo

saawsm / libfixmath Goto Github PK

View Code? Open in Web Editor NEW

This project forked from petteriaimonen/libfixmath

0.0 0.0 0.0 623 KB

Cross Platform Fixed Point Maths Library

Home Page: https://code.google.com/p/libfixmath/

License: Other

C++ 1.54% Python 0.41% C 97.32% Makefile 0.26% CMake 0.47%

libfixmath's Introduction

libfixmath

This is a mirror of the libfixmath's original SVN repository on Google Code.

Not actively maintained, pull requests welcome.

Libfixmath implements Q16.16 format fixed point operations in C.

License: MIT

Options

Configuration options are compile definitions that are checked by the preprocessor with #ifdef and #ifndef. All of these are undefined by default.

FIXMATH_FAST_SIN

  • #ifndef: Most accurate version, accurate to ~2.1%.
  • #ifdef: Fast implementation, runs at 159% the speed of above 'accurate' version with a slightly lower accuracy of ~2.3%.

FIXMATH_NO_64BIT

  • #ifndef: For compilers/platforms that have uint64_t.
  • #ifdef: For compilers/platforms that do not have uint64_t.

FIXMATH_NO_CACHE

  • #ifndef: Use static memory caches for exponents (32KB) and trigonometry (80KB).
  • #ifdef: Do not use caches.

FIXMATH_NO_HARD_DIVISION

Note: will be automatically defined if FIXMATH_OPTIMIZE_8BIT is defined.

  • #ifndef: For platforms that have hardware integer division.
  • #ifdef: For platforms that do not have hardware integer division.

FIXMATH_NO_OVERFLOW

  • #ifndef: Check for overflow and return the overflow constants.
  • #ifdef: Do not check for overflow.

FIXMATH_NO_ROUNDING

  • #ifndef: Use rounding.
  • #ifdef: Do not use rounding.

FIXMATH_OPTIMIZE_8BIT

  • #ifndef: Do not optimize for processors with 8-bit multiplication like Atmel AVR.
  • #ifdef: Optimize for processors like Atmel AVR. Also defines FIXMATH_NO_HARD_DIVISION automatically in fix16.h.

Include the libfixmath library in your CMake Project

The simplest way to use libfixmath as a dependency is with CMake's FetchContent API.

include(FetchContent)
FetchContent_Declare(
    libfixmath
    GIT_REPOSITORY https://github.com/PetteriAimonen/libfixmath.git
    GIT_TAG <the long git hash of the version you want>
)
FetchContent_MakeAvailable(libfixmath)

target_compile_definitions(libfixmath PRIVATE
    # FIXMATH_FAST_SIN
    # FIXMATH_NO_64BIT
    # FIXMATH_NO_CACHE
    # FIXMATH_NO_HARD_DIVISION
    # FIXMATH_NO_OVERFLOW
    # FIXMATH_NO_ROUNDING
    # FIXMATH_OPTIMIZE_8BIT
)

target_link_libraries(my_cmake_project PRIVATE libfixmath)

libfixmath's People

Contributors

petteriaimonen avatar maruncz avatar joesc avatar dlech avatar jphutchins avatar toufinet avatar flatmush avatar novakasa avatar theacodes avatar althonos avatar systemofapwne avatar adrienbruant avatar benpicco avatar danyspin97 avatar cladmi avatar htv04 avatar barracuda156 avatar xli2022 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.