1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>3.5.�Fixed-Point Arithmetic</title><link rel="stylesheet" type="text/css" href="cs.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.0"><link rel="home" href="index.html" title="Sourcery CodeBench Lite"><link rel="up" href="chap-target.html" title="Chapter�3.�Sourcery CodeBench Lite for ARM EABI"><link rel="prev" href="sec-armfloat.html" title="3.4.�Using VFP Floating Point"><link rel="next" href="ch03s06.html" title="3.6.�ABI Compatibility"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.5.�Fixed-Point Arithmetic</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-armfloat.html">Prev</a>�</td><th width="60%" align="center">Chapter�3.�Sourcery CodeBench Lite for ARM EABI</th><td width="20%" align="right">�<a accesskey="n" href="ch03s06.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec-arm-fixed-point"></a>3.5.�Fixed-Point Arithmetic</h2></div></div></div><p> 2 Sourcery CodeBench for ARM EABI includes experimental support for 3 fixed-point arithmetic using a set of new data types, as described in the 4 draft ISO/IEC technical report TR 18037. This support is provided for all 5 ARM targets, and uses specialized instructions where available, e.g. 6 saturating add and subtract operations on ARMv6T2 and above. Library 7 functions are used for operations which are not natively supported on 8 the target architecture. 9 </p><p> 10 This feature is a GNU extension, so is only available when the selected 11 language standard includes GNU extensions (e.g. 12 <code class="option">-std=gnu90</code>, which is the default). Furthermore, only C is 13 supported, not C++. 14 </p><p> 15 TR 18037 leaves up to the implementation the sizes of various quantities 16 within the new data types it defines. For Sourcery CodeBench for ARM EABI, 17 these are, briefly: 18 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="type">short _Fract</code>: One sign bit, 7 fractional bits</li><li class="listitem"><code class="type">_Fract</code>: One sign bit, 15 fractional bits</li><li class="listitem"><code class="type">long _Fract</code>: One sign bit, 31 fractional bits</li><li class="listitem"><code class="type">unsigned short _Fract</code>: 8 fractional bits</li><li class="listitem"><code class="type">unsigned _Fract</code>: 16 fractional bits</li><li class="listitem"><code class="type">unsigned long _Fract</code>: 32 fractional bits</li><li class="listitem"><code class="type">short _Accum</code>: One sign bit, 7 fractional bits, 8 integral bits</li><li class="listitem"><code class="type">_Accum</code>: One sign bit, 15 fractional bits, 16 integral bits</li><li class="listitem"><code class="type">long _Accum</code>: One sign bit, 31 fractional bits, 32 integral bits</li><li class="listitem"><code class="type">unsigned short _Accum</code>: 8 fractional bits, 8 integral bits</li><li class="listitem"><code class="type">unsigned _Accum</code>: 16 fractional bits, 16 integral bits</li><li class="listitem"><code class="type">unsigned long _Accum</code>: 32 fractional bits, 32 integral bits</li></ul></div><p> 19 </p><p> 20 These values (and various other useful constants) are also defined 21 in the header file <code class="filename">stdfix.h</code> 22 for use in your programs. Note that there is currently no support 23 for the new standard-library functions described in TR 18037, nor 24 for the pragmas controlling precision of operations. 25 </p><p> 26 Fixed-point extensions are not currently supported by GDB, nor are 27 they compliant with the ARM EABI (which does not specify anything 28 about fixed-point types at present). Code using fixed-point types 29 cannot be expected to interact properly (across ABI boundaries) 30 with code generated by other compilers for the ARM architecture. 31 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-armfloat.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="chap-target.html">Up</a></td><td width="40%" align="right">�<a accesskey="n" href="ch03s06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.4.�Using VFP Floating Point�</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">�3.6.�ABI Compatibility</td></tr></table></div></body></html> 32