Page MenuHomePhabricator

[Fixed Point Arithmetic] Predefined Precision Macros
Needs ReviewPublic

Authored by leonardchan on May 16 2018, 9:53 AM.



This patch contains the addition of the precision macros for integral and fractional bits according to clause 7.18a.3 of The macros are integer constants and added as predefined macros.

// Fractional bits of _Accum types

// Fractional bits of _Fract types

// Integral bits of _Accum types

Diff Detail

rC Clang

Event Timeline

leonardchan created this revision.May 16 2018, 9:53 AM
ebevhan added inline comments.

You should not reserve identifiers like this for built-in limit/precision macros. See InitPreprocessor.cpp to see how it's supposed to be done.

We have implemented all of these (at least for DSP-C, but it should not be difficult to port this to Embedded-C) in our downstream port. You will also need routines to print fixed-point numbers for the rest of the macros in 7.18a.3. We can provide these patches on request.

Ka-Ka added a subscriber: Ka-Ka.May 23 2018, 1:08 AM