gcc: Fixed-Point

1 
1 6.15 Fixed-Point Types
1 ======================
1 
1 As an extension, GNU C supports fixed-point types as defined in the
1 N1169 draft of ISO/IEC DTR 18037.  Support for fixed-point types in GCC
1 will evolve as the draft technical report changes.  Calling conventions
1 for any target might also change.  Not all targets support fixed-point
1 types.
1 
1  The fixed-point types are 'short _Fract', '_Fract', 'long _Fract',
1 'long long _Fract', 'unsigned short _Fract', 'unsigned _Fract',
1 'unsigned long _Fract', 'unsigned long long _Fract', '_Sat short
1 _Fract', '_Sat _Fract', '_Sat long _Fract', '_Sat long long _Fract',
1 '_Sat unsigned short _Fract', '_Sat unsigned _Fract', '_Sat unsigned
1 long _Fract', '_Sat unsigned long long _Fract', 'short _Accum',
1 '_Accum', 'long _Accum', 'long long _Accum', 'unsigned short _Accum',
1 'unsigned _Accum', 'unsigned long _Accum', 'unsigned long long _Accum',
1 '_Sat short _Accum', '_Sat _Accum', '_Sat long _Accum', '_Sat long long
1 _Accum', '_Sat unsigned short _Accum', '_Sat unsigned _Accum', '_Sat
1 unsigned long _Accum', '_Sat unsigned long long _Accum'.
1 
1  Fixed-point data values contain fractional and optional integral parts.
1 The format of fixed-point data varies and depends on the target machine.
1 
1  Support for fixed-point types includes:
1    * prefix and postfix increment and decrement operators ('++', '--')
1    * unary arithmetic operators ('+', '-', '!')
1    * binary arithmetic operators ('+', '-', '*', '/')
1    * binary shift operators ('<<', '>>')
1    * relational operators ('<', '<=', '>=', '>')
1    * equality operators ('==', '!=')
1    * assignment operators ('+=', '-=', '*=', '/=', '<<=', '>>=')
1    * conversions to and from integer, floating-point, or fixed-point
1      types
1 
1  Use a suffix in a fixed-point literal constant:
1    * 'hr' or 'HR' for 'short _Fract' and '_Sat short _Fract'
1    * 'r' or 'R' for '_Fract' and '_Sat _Fract'
1    * 'lr' or 'LR' for 'long _Fract' and '_Sat long _Fract'
1    * 'llr' or 'LLR' for 'long long _Fract' and '_Sat long long _Fract'
1    * 'uhr' or 'UHR' for 'unsigned short _Fract' and '_Sat unsigned short
1      _Fract'
1    * 'ur' or 'UR' for 'unsigned _Fract' and '_Sat unsigned _Fract'
1    * 'ulr' or 'ULR' for 'unsigned long _Fract' and '_Sat unsigned long
1      _Fract'
1    * 'ullr' or 'ULLR' for 'unsigned long long _Fract' and '_Sat unsigned
1      long long _Fract'
1    * 'hk' or 'HK' for 'short _Accum' and '_Sat short _Accum'
1    * 'k' or 'K' for '_Accum' and '_Sat _Accum'
1    * 'lk' or 'LK' for 'long _Accum' and '_Sat long _Accum'
1    * 'llk' or 'LLK' for 'long long _Accum' and '_Sat long long _Accum'
1    * 'uhk' or 'UHK' for 'unsigned short _Accum' and '_Sat unsigned short
1      _Accum'
1    * 'uk' or 'UK' for 'unsigned _Accum' and '_Sat unsigned _Accum'
1    * 'ulk' or 'ULK' for 'unsigned long _Accum' and '_Sat unsigned long
1      _Accum'
1    * 'ullk' or 'ULLK' for 'unsigned long long _Accum' and '_Sat unsigned
1      long long _Accum'
1 
1  GCC support of fixed-point types as specified by the draft technical
1 report is incomplete:
1 
1    * Pragmas to control overflow and rounding behaviors are not
1      implemented.
1 
1  Fixed-point types are supported by the DWARF debug information format.
1