• Stars
    star
    702
  • Rank 62,084 (Top 2 %)
  • Language
    C
  • License
    Other
  • Created almost 9 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cross Platform Fixed Point Maths Library

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)

More Repositories

1

libfixmatrix

C library for fixed point matrix, quaternion and vector calculations
C
410
star
2

ED060SC4_driver

Driver for the ED060SC4 E-ink display
C
203
star
3

focus-stack

Fast and easy focus stacking
C++
196
star
4

STM32_Trace_Example

Example on using the ITM/ETM tracing on STM32 (and generally any Cortex-M3)
C
99
star
5

Baselibc

Small C library for microcontrollers. Code is based on klibc.
C
93
star
6

QuadPawn

Pawn scripting language for the DSO Quad pocket oscilloscope.
C
76
star
7

latex-datasheet-template

LaTeX document class for electronics datasheets
TeX
68
star
8

dso-quad-logic

Logic analyzer for the DSO Quad
C
33
star
9

esp-walkie-talkie

Software for a ESP8266 based walkie talkie radio (doesn't work very well)
C
24
star
10

dso-quad-usb-analyzer

USB Full-Speed (12Mbps) protocol analyzer for the DSO Quad
VHDL
21
star
11

ebike-controller

Chibios-based ebike controller
C
15
star
12

nanopb-benchmark

Benchmark of several Protocol Buffers implementations suitable for use on embedded devices.
Protocol Buffer
15
star
13

AlterBIOS

Extensions and fixes for DSO Quad BIOS (SYS.HEX)
C
11
star
14

owon-xdm2041-info

Information about Owon XDM2041 internals
Python
11
star
15

esp-walkie-talkie-hw

Hardware for ESP8266 based walkie talkie (doesn't work particularly well)
OpenSCAD
10
star
16

blender_addons

Blender addons development
Python
8
star
17

crs-c500c-utils

Utilities for Thermo CRS C500C series robot arm controllers
Rebol
7
star
18

tem-cell

DIY TEM cell design for EMC measurements
5
star
19

arm_coresight_decoder

Unfinished ARM Coresight (ETM/ITM) decoder in Rust
Rust
3
star
20

bletalk

Beginnings of a Silicon Labs BGM113 + GCC project
C
1
star
21

nerm

Nerm - No Effort Requirements Management
Python
1
star
22

tardis-controller

STM32F030 bare bones project
C
1
star