AVR-LibC  2.3.0
Standard C library for AVR-GCC
 

AVR-LibC Manual

AVR-LibC Sources

Main Page

User Manual

Lib­rary Refe­rence

FAQ

Exam­ple Pro­jects

Index

Loading...
Searching...
No Matches
stdfix-avrlibc.h
Go to the documentation of this file.
1/* Copyright (c) 2013 Joerg Wunsch
2 All rights reserved.
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
6
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in
12 the documentation and/or other materials provided with the
13 distribution.
14
15 * Neither the name of the copyright holders nor the names of
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 POSSIBILITY OF SUCH DAMAGE. */
30
31#ifndef _STDFIX_AVRLIBC_H
32#define _STDFIX_AVRLIBC_H
33
34/*
35 * AVR-LibC addendum file for Embedded C Fixed-Point support
36 *
37 * See: ISO/IEC TR 18037
38 * http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf
39 */
40
41#ifndef _AVRGCC_STDFIX_H /* Defined in stdfix.h from avr-gcc */
42#warning please include <stdfix.h> directly rather than <stdfix-avrlibc.h>
43#endif /* _AVRGCC_STDFIX_H */
44
45#include <bits/attribs.h>
46
47/** \file */
48/** \anchor stdfix_h
49 \defgroup avr_stdfix <stdfix.h>: ISO/IEC TR 18037 Fixed-Point Arithmetic
50\if STDFIX_AVRLIBC_H_NOT_INCLUDED
51 \code
52 #include <stdfix.h>
53 #include <stdfix-avrlibc.h>
54 \endcode
55\else
56 \code
57 #include <stdfix.h>
58 \endcode
59\endif
60
61As an extension, GNU C supports fixed-point types as defined in the
62N1169 draft of ISO/IEC DTR 18037.
63
64\since <a href="https://gcc.gnu.org/gcc-4.8/changes.html#avr"
65 >avr-gcc v4.8</a>
66
67Two groups of fixed-point data types are added:
68- The <em>fract types</em> and the <em>accum types</em>.
69 The data value of a \e fract type has no integral part,
70 hence values of a \e fract type are between -1.0 and +1.0.
71- The value range of an \e accum type depends on the number of integral bits
72 in the data type.
73
74<table>
75<caption>Fixed-Point Type Layout</caption>
76<tr><th>Const Suffix <th>Type <th>Size <th>Q-Format <th> Epsilon
77<tr><td align="right"><tt>hr</tt> <td align="right"><tt>short fract</tt> <td>1<td>s.7 <td>7.81&middot;10<sup>-3</sup>
78<tr><td align="right"><tt>r</tt> <td align="right"><tt>fract</tt> <td>2<td>s.15 <td>3.05&middot;10<sup>-5</sup>
79<tr><td align="right"><tt>lr</tt> <td align="right"><tt>long fract</tt> <td>4<td>s.31 <td>4.66&middot;10<sup>-10</sup>
80<tr><td align="right"><tt>llr</tt> <td align="right"><tt>long long fract</tt> <td>8<td>s.63<td>1.08&middot;10<sup>-19</sup>
81<tr><td align="right"><tt>hk</tt> <td align="right"><tt>short accum</tt> <td>2<td>s8.7 <td>7.81&middot;10<sup>-3</sup>
82<tr><td align="right"><tt>k</tt> <td align="right"><tt>accum</tt> <td>4<td>s16.15 <td>3.05&middot;10<sup>-5</sup>
83<tr><td align="right"><tt>lk</tt> <td align="right"><tt>long accum</tt> <td>8<td>s32.31 <td>4.66&middot;10<sup>-10</sup>
84<tr><td align="right"><tt>llk</tt> <td align="right"><tt>long long accum</tt> <td>8<td>s16.47 <td>7.11&middot;10<sup>-15</sup>
85<tr><td align="right"><tt>uhr</tt> <td align="right"><tt>unsigned short fract</tt> <td>1<td>0.8 <td>3.91&middot;10<sup>-3</sup>
86<tr><td align="right"><tt>ur</tt> <td align="right"><tt>unsigned fract</tt> <td>2<td>0.16 <td>1.53&middot;10<sup>-5</sup>
87<tr><td align="right"><tt>ulr</tt> <td align="right"><tt>unsigned long fract</tt> <td>4<td>0.32 <td>2.33&middot;10<sup>-10</sup>
88<tr><td align="right"><tt>ullr</tt><td align="right"><tt>unsigned long long fract</tt><td>8<td>0.64 <td>5.42&middot;10<sup>-20</sup>
89<tr><td align="right"><tt>uhk</tt> <td align="right"><tt>unsigned short accum</tt> <td>2<td>8.8 <td>3.91&middot;10<sup>-3</sup>
90<tr><td align="right"><tt>uk</tt> <td align="right"><tt>unsigned accum</tt> <td>4<td>16.16<td>1.53&middot;10<sup>-5</sup>
91<tr><td align="right"><tt>ulk</tt> <td align="right"><tt>unsigned long accum</tt> <td>8<td>32.32<td>2.33&middot;10<sup>-10</sup>
92<tr><td align="right"><tt>ullk</tt><td align="right"><tt>unsigned long long accum</tt> <td>8<td>16.48<td>3.55&middot;10<sup>-15</sup>
93</table>
94\remark
95 - Upper case constant suffixes are also supported.
96 - The \c long \c long fixed-point types are avr-gcc extensions.
97
98See also some \ref bench_fxlib "benchmarks".
99*/
100
101
102/* Room for AVR-LibC specific extensions */
103
104/* 7.18a.6.1 The fixed-point arithmetic operation support functions */
105
106#ifdef __cplusplus
107extern "C" {
108#endif
109
110/** \ingroup avr_stdfix
111 Include all significant digits in the result of a
112 fixed-point to decimal ASCII conversion.
113 The result has no trailing zeros.
114
115 To be used in the \a mode parameter of such a conversion.
116 For details and examples, see uktoa().
117 \since AVR-LibC v2.3 */
118#define FXTOA_ALL 0x1f
119
120/** \ingroup avr_stdfix
121 A flag to select rounding to nearest in a fixed-point to
122 decimal ASCII conversion. Rounding mode is the default,
123 i.e. FXTOA_ROUND can be omitted.
124
125 To be used in the \a mode parameter of such a conversion.
126 For details and examples, see uktoa().
127 \since AVR-LibC v2.3 */
128#define FXTOA_ROUND 0x00
129
130/** \ingroup avr_stdfix
131 A flag to select truncation (rounding to zero) in a fixed-point to
132 decimal ASCII conversion.
133
134 To be used in the \a mode parameter of such a conversion.
135 For details and examples, see uktoa().
136 \since AVR-LibC v2.3 */
137#define FXTOA_TRUNC 0x80
138
139/** \ingroup avr_stdfix
140 A flag to select that the result of a fixed-point to
141 decimal ASCII conversion has no trailing zeros.
142
143 To be used in the \a mode parameter of such a conversion.
144 For details and examples, see uktoa().
145 \since AVR-LibC v2.3 */
146#define FXTOA_NTZ 0x40
147
148/** \ingroup avr_stdfix
149 The fixed-point to decimal ASCII conversion routines use a
150 dot (<tt>.</tt>) for the decimal point. This is the default, i.e.
151 FXTOA_DOT can be omitted.
152
153 For details, and examples, see uktoa().
154 \since AVR-LibC v2.3 */
155#define FXTOA_DOT 0x00
156
157/** \ingroup avr_stdfix
158 The fixed-point to decimal ASCII conversion routines use a
159 comma (<tt>,</tt>) for the decimal point.
160
161 For details and examples, see uktoa().
162 \since AVR-LibC v2.3 */
163#define FXTOA_COMMA 0x20
164
165
166#ifdef __DOXYGEN__
167
168/** \name ASCII Conversions (not in ISO/IEC TR18037) */
169
170/** \ingroup avr_stdfix
171 Convert fixed-point value \p x to a decimal ASCII representation.
172 The result is written to \p buf, and the user is responsible for
173 providing enough memory in \p buf. Returns \p buf.
174
175 For the meaning of \p mode, and for the (maximal) number of
176 character written by this function, see uktoa().
177 \since AVR-LibC v2.3 */
178char* hktoa (short accum x, char *buf, unsigned char mode);
179
180/** \ingroup avr_stdfix
181 Convert fixed-point value \p x to a decimal ASCII representation.
182 The result is written to \p buf, and the user is responsible for
183 providing enough memory in \p buf. Returns \p buf.
184
185 For the meaning of \p mode, and for the (maximal) number of
186 character written by this function, see uktoa().
187 \since AVR-LibC v2.3 */
188char* hrtoa (short fract x, char *buf, unsigned char mode);
189
190/** \ingroup avr_stdfix
191 Convert fixed-point value \p x to a decimal ASCII representation.
192 The result is written to \p buf, and the user is responsible for
193 providing enough memory in \p buf. Returns \p buf.
194
195 For the meaning of \p mode, and for the (maximal) number of
196 character written by this function, see uktoa().
197 \since AVR-LibC v2.3 */
198char* ktoa (accum x, char *buf, unsigned char mode);
199
200/** \ingroup avr_stdfix
201 Convert fixed-point value \p x to a decimal ASCII representation.
202 The result is written to \p buf, and the user is responsible for
203 providing enough memory in \p buf. Returns \p buf.
204
205 For the meaning of \p mode, and for the (maximal) number of
206 character written by this function, see uktoa().
207 \since AVR-LibC v2.3 */
208char* rtoa (fract x, char *buf, unsigned char mode);
209
210/** \ingroup avr_stdfix
211 Convert fixed-point value \p x to a decimal ASCII representation.
212 The result is written to \p buf, and the user is responsible for
213 providing enough memory in \p buf. Returns \p buf.
214
215 For the meaning of \p mode, and for the (maximal) number of
216 character written by this function, see uktoa().
217 \since AVR-LibC v2.3 */
218char* uhktoa (unsigned short accum x, char *buf, unsigned char mode);
219
220/** \ingroup avr_stdfix
221 Convert fixed-point value \p x to a decimal ASCII representation.
222 The result is written to \p buf, and the user is responsible for
223 providing enough memory in \p buf. Returns \p buf.
224
225 For the meaning of \p mode, and for the (maximal) number of
226 character written by this function, see uktoa().
227 \since AVR-LibC v2.3 */
228char* uhrtoa (unsigned short fract x, char *buf, unsigned char mode);
229
230/** \ingroup avr_stdfix
231 Convert fixed-point value \p x to a decimal ASCII representation.
232 The result is written to \p buf, and the user is responsible for
233 providing enough memory in \p buf. Returns \p buf.
234
235 The format of the output is controlled by the \a mode parameter.
236 It is composed from the format flags below together with \a Digs,
237 the number of fractional digits.
238 The \p mode is the ORed result from \a Digs and a combination of
239 #FXTOA_ALL, #FXTOA_ROUND or #FXTOA_TRUNC, #FXTOA_DOT or #FXTOA_COMMA,
240 and #FXTOA_NTZ, like in:
241 \code
242 uktoa (x, buf, FXTOA_ROUND | FXTOA_NTZ | Digs);
243 \endcode
244
245 - Supported values for \a Digs are in the range 0...30.
246
247<dl>
248 <dt>#FXTOA_ALL
249 <dd>Include all significant digits. \a Digs will be ignored.
250
251 <dt>#FXTOA_ROUND
252 <dd>Round to nearest for \a Digs fractional digits.
253 Rounding for \a Digs &ge; 5 has no effect, i.e. for such \a Digs values
254 the rounded result will be the same like the truncated result.
255 Rounding mode is the default, i.e. FXTOA_ROUND can be omitted.
256
257 <dt>#FXTOA_TRUNC
258 <dd>Like FXTOA_ALL, but truncate the result (round to zero)
259 after \a Digs fractional digits.
260
261 <dt>#FXTOA_NTZ
262 <dd>
263 &bull;&nbsp;With FXTOA_NTZ the result has
264 <b>n</b>o <b>t</b>railing <b>z</b>eros.
265 When the result represents an integral value,
266 then no decimal point and no fractional digits are present.<br>
267 &bull;&nbsp;Without FXTOA_NTZ and with FXTOA_ROUND or FXTOA_TRUNC,
268 the result has the specified number of fractional digits.<br>
269 &bull;&nbsp;FXTOA_NTZ has no effect with FXTOA_ALL.<br>
270 &bull;&nbsp;FXTOA_NTZ has no effect on the required buffer size.
271 <dt>#FXTOA_DOT
272 <dd>The decimal point is a dot (<tt>.</tt>).
273 This is the default, i.e. FXTOA_DOT can be omitted.
274
275 <dt>#FXTOA_COMMA
276 <dd>The decimal point is a comma (<tt>,</tt>).
277</dl>
278
279<table>
280<caption>Examples</caption>
281<tr>
282 <th>Value
283 <th>Mode
284 <th>Result
285</tr>
286<tr><td>1.8uk<td><tt>0</tt><td><tt>"2"</tt></tr>
287<tr><td>1.8uk<td><tt>1</tt><td><tt>"1.8"</tt></tr>
288<tr><td>1.8uk<td><tt>2</tt><td><tt>"1.80"</tt></tr>
289<tr><td>1.8uk<td><tt>3</tt><td><tt>"1.800"</tt></tr>
290<tr><td>1.8uk<td><tt>FXTOA_NTZ | 0</tt><td><tt>"2"</tt></tr>
291<tr><td>1.8uk<td><tt>FXTOA_NTZ | 1</tt><td><tt>"1.8"</tt></tr>
292<tr><td>1.8uk<td><tt>FXTOA_NTZ | 2</tt><td><tt>"1.8"</tt></tr>
293<tr><td>1.8uk<td><tt>FXTOA_NTZ | 3</tt><td><tt>"1.8"</tt></tr>
294<tr><td>1.8uk<td><tt>FXTOA_TRUNC | FXTOA_COMMA | 0</tt><td><tt>"1"</tt></tr>
295<tr><td>1.8uk<td><tt>FXTOA_TRUNC | FXTOA_COMMA | 1</tt><td><tt>"1,7"</tt></tr>
296<tr><td>1.8uk<td><tt>FXTOA_TRUNC | FXTOA_COMMA | 2</tt><td><tt>"1,79"</tt></tr>
297<tr><td>1.8uk<td><tt>FXTOA_TRUNC | FXTOA_COMMA | 3</tt><td><tt>"1,799"</tt></tr>
298<tr><td>1.8uk<td><tt>FXTOA_ALL</tt> <td><tt>"1.79998779296875"</tt></tr>
299</table>
300
301The following table helps with providing enough memory in \a buf.
302
303Notice that the required size of \a buf is independent of #FXTOA_NTZ.
304This is the case since with #FXTOA_NTZ the required buffer size may
305be larger that the size of the returned string.
306
307<table>
308 <caption>Maximum Number of Bytes written to buf</caption>
309 <tr>
310 <th>Type
311 <th>Function
312 <th>FXTOA_ALL
313 <th>All other Modes
314 <th colspan="2">Exact Maximal Value
315 </tr>
316 <tr>
317 <td align="right"><tt>unsigned accum</tt>
318 <td align="right">#uktoa
319 <td align="center">23
320 <td align="center">7 + \a Digs
321 <td align="center">2<sup>16</sup>-2<sup>-16</sup>
322 <td>65535.9999847412109375
323 <tr>
324 <td align="right"><tt>accum</tt>
325 <td align="right">#ktoa
326 <td align="center">23
327 <td align="center">8 + \a Digs
328 <td align="center">2<sup>16</sup>-2<sup>-15</sup>
329 <td>65535.999969482421875
330 <tr>
331 <td align="right"><tt>unsigned short accum</tt>
332 <td align="right">#uhktoa
333 <td align="center">13
334 <td align="center">5 + \a Digs
335 <td align="center">2<sup>8</sup>-2<sup>-8</sup>
336 <td>255.99609375
337 <tr>
338 <td align="right"><tt>short accum</tt>
339 <td align="right">#hktoa
340 <td align="center">13
341 <td align="center">6 + \a Digs
342 <td align="center">2<sup>8</sup>-2<sup>-7</sup>
343 <td>255.9921875
344 <tr>
345 <td align="right"><tt>unsigned fract</tt>
346 <td align="right">#urtoa
347 <td align="center">19
348 <td align="center">3 + \a Digs
349 <td align="center">1-2<sup>-16</sup>
350 <td>0.9999847412109375
351 <tr>
352 <td align="right"><tt>fract</tt>
353 <td align="right">#rtoa
354 <td align="center">19
355 <td align="center">4 + \a Digs
356 <td align="center">1-2<sup>-15</sup>
357 <td>0.999969482421875
358 <tr>
359 <td align="right"><tt>unsigned short fract</tt>
360 <td align="right">#uhrtoa
361 <td align="center">11
362 <td align="center">3 + \a Digs
363 <td align="center">1-2<sup>-8</sup>
364 <td>0.99609375
365 <tr>
366 <td align="right"><tt>short fract</tt>
367 <td align="right">#hrtoa
368 <td align="center">11
369 <td align="center">4 + \a Digs
370 <td align="center">1-2<sup>-7</sup>
371 <td>0.9921875
372 </tr>
373</table>
374
375 \since AVR-LibC v2.3 */
376char* uktoa (unsigned accum x, char *buf, unsigned char mode);
377
378/** \ingroup avr_stdfix
379 Convert fixed-point value \p x to a decimal ASCII representation.
380 The result is written to \p buf, and the user is responsible for
381 providing enough memory in \p buf. Returns \p buf.
382
383 For the meaning of \p mode, and for the (maximal) number of
384 character written by this function, see uktoa().
385 \since AVR-LibC v2.3 */
386char* urtoa (unsigned fract x, char *buf, unsigned char mode);
387
388
389/** \name Absolute Value */
390
391/** \ingroup avr_stdfix
392 Computes the absolute value of \p val. When the result does not
393 fit into the range of the return type, the result is saturated. */
394short fract abshr (short fract val);
395
396/** \ingroup avr_stdfix
397 Computes the absolute value of \p val. When the result does not
398 fit into the range of the return type, the result is saturated. */
399fract absr (fract val);
400
401/** \ingroup avr_stdfix
402 Computes the absolute value of \p val. When the result does not
403 fit into the range of the return type, the result is saturated. */
404long fract abslr (long fract val);
405
406/** \ingroup avr_stdfix
407 Computes the absolute value of \p val. When the result does not
408 fit into the range of the return type, the result is saturated. */
409long long fract absllr (long long fract val);
410
411/** \ingroup avr_stdfix
412 Computes the absolute value of \p val. When the result does not
413 fit into the range of the return type, the result is saturated. */
414short accum abshk (short accum val);
415
416/** \ingroup avr_stdfix
417 Computes the absolute value of \p val. When the result does not
418 fit into the range of the return type, the result is saturated. */
419accum absk (accum val);
420
421/** \ingroup avr_stdfix
422 Computes the absolute value of \p val. When the result does not
423 fit into the range of the return type, the result is saturated. */
424long accum abslk (long accum val);
425
426/** \ingroup avr_stdfix
427 Computes the absolute value of \p val. When the result does not
428 fit into the range of the return type, the result is saturated. */
429long long accum absllk (long long accum val);
430
431
432/** \name Bit-Conversions to Integer */
433
434/** \ingroup avr_stdfix
435 Return an integer value of the same size and signedness,
436 and with the same bit representation like \p val. */
437signed char bitshr (short fract val);
438
439/** \ingroup avr_stdfix
440 Return an integer value of the same size and signedness,
441 and with the same bit representation like \p val. */
442unsigned char bitsuhr (unsigned short fract val);
443
444/** \ingroup avr_stdfix
445 Return an integer value of the same size and signedness,
446 and with the same bit representation like \p val. */
447int bitsr (fract val);
448
449/** \ingroup avr_stdfix
450 Return an integer value of the same size and signedness,
451 and with the same bit representation like \p val. */
452unsigned int bitsur (unsigned fract val);
453
454/** \ingroup avr_stdfix
455 Return an integer value of the same size and signedness,
456 and with the same bit representation like \p val. */
457long bitslr (long fract val);
458
459/** \ingroup avr_stdfix
460 Return an integer value of the same size and signedness,
461 and with the same bit representation like \p val. */
462unsigned long bitsulr (unsigned long fract val);
463
464/** \ingroup avr_stdfix
465 Return an integer value of the same size and signedness,
466 and with the same bit representation like \p val. */
467long long bitsllr (long long fract val);
468
469/** \ingroup avr_stdfix
470 Return an integer value of the same size and signedness,
471 and with the same bit representation like \p val. */
472unsigned long long bitsullr (unsigned long long fract val);
473
474/** \ingroup avr_stdfix
475 Return an integer value of the same size and signedness,
476 and with the same bit representation like \p val. */
477int bitshk (short accum val);
478
479/** \ingroup avr_stdfix
480 Return an integer value of the same size and signedness,
481 and with the same bit representation like \p val. */
482unsigned int bitsuhk (unsigned short accum val);
483
484/** \ingroup avr_stdfix
485 Return an integer value of the same size and signedness,
486 and with the same bit representation like \p val. */
487long bitsk (accum val);
488
489/** \ingroup avr_stdfix
490 Return an integer value of the same size and signedness,
491 and with the same bit representation like \p val. */
492unsigned long bitsuk (unsigned accum val);
493
494/** \ingroup avr_stdfix
495 Return an integer value of the same size and signedness,
496 and with the same bit representation like \p val. */
497long long bitslk (long accum val);
498
499/** \ingroup avr_stdfix
500 Return an integer value of the same size and signedness,
501 and with the same bit representation like \p val. */
502unsigned long long bitsulk (unsigned long accum val);
503
504/** \ingroup avr_stdfix
505 Return an integer value of the same size and signedness,
506 and with the same bit representation like \p val. */
507long long bitsllk (long long accum val);
508
509/** \ingroup avr_stdfix
510 Return an integer value of the same size and signedness,
511 and with the same bit representation like \p val. */
512unsigned long long bitsullk (unsigned long long accum val);
513
514
515/** \name Bit-Conversions to Fixed-Point */
516
517/** \ingroup avr_stdfix
518 Return a fixed-point value of the same size and signedness,
519 and with the same bit representation like \p val. */
520short fract hrbits (signed char val);
521
522/** \ingroup avr_stdfix
523 Return a fixed-point value of the same size and signedness,
524 and with the same bit representation like \p val. */
525unsigned short fract uhrbits (unsigned char val);
526
527/** \ingroup avr_stdfix
528 Return a fixed-point value of the same size and signedness,
529 and with the same bit representation like \p val. */
530fract rbits (int val);
531
532/** \ingroup avr_stdfix
533 Return a fixed-point value of the same size and signedness,
534 and with the same bit representation like \p val. */
535unsigned fract urbits (unsigned int val);
536
537/** \ingroup avr_stdfix
538 Return a fixed-point value of the same size and signedness,
539 and with the same bit representation like \p val. */
540long fract lrbits (long val);
541
542/** \ingroup avr_stdfix
543 Return a fixed-point value of the same size and signedness,
544 and with the same bit representation like \p val. */
545unsigned long fract ulrbits (unsigned long val);
546
547/** \ingroup avr_stdfix
548 Return a fixed-point value of the same size and signedness,
549 and with the same bit representation like \p val. */
550long long fract llrbits (long long val);
551
552/** \ingroup avr_stdfix
553 Return a fixed-point value of the same size and signedness,
554 and with the same bit representation like \p val. */
555unsigned long long fract ullrbits (unsigned long long val);
556
557/** \ingroup avr_stdfix
558 Return a fixed-point value of the same size and signedness,
559 and with the same bit representation like \p val. */
560short accum hkbits (int val);
561
562/** \ingroup avr_stdfix
563 Return a fixed-point value of the same size and signedness,
564 and with the same bit representation like \p val. */
565unsigned short accum uhkbits (unsigned int val);
566
567/** \ingroup avr_stdfix
568 Return a fixed-point value of the same size and signedness,
569 and with the same bit representation like \p val. */
570accum kbits (long val);
571
572/** \ingroup avr_stdfix
573 Return a fixed-point value of the same size and signedness,
574 and with the same bit representation like \p val. */
575unsigned accum ukbits (unsigned long val);
576
577/** \ingroup avr_stdfix
578 Return a fixed-point value of the same size and signedness,
579 and with the same bit representation like \p val. */
580long accum lkbits (long long val);
581
582/** \ingroup avr_stdfix
583 Return a fixed-point value of the same size and signedness,
584 and with the same bit representation like \p val. */
585unsigned long accum ulkbits (unsigned long long val);
586
587/** \ingroup avr_stdfix
588 Return a fixed-point value of the same size and signedness,
589 and with the same bit representation like \p val. */
590long long accum llkbits (long long val);
591
592/** \ingroup avr_stdfix
593 Return a fixed-point value of the same size and signedness,
594 and with the same bit representation like \p val. */
595unsigned long long accum ullkbits (unsigned long long val);
596
597/** \name Count Left-Shift */
598
599/** \ingroup avr_stdfix
600 - If \p val is non-zero, the return value is the largest integer
601 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
602 - If \p val is zero, an integer value is returned that is at least
603 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
604 of bits of the type of the argument. */
605int countlshr (short fract val);
606
607/** \ingroup avr_stdfix
608 - If \p val is non-zero, the return value is the largest integer
609 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
610 - If \p val is zero, an integer value is returned that is at least
611 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
612 of bits of the type of the argument. */
613int countlsuhr (unsigned short fract val);
614
615/** \ingroup avr_stdfix
616 - If \p val is non-zero, the return value is the largest integer
617 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
618 - If \p val is zero, an integer value is returned that is at least
619 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
620 of bits of the type of the argument. */
621int countlsr (fract val);
622
623/** \ingroup avr_stdfix
624 - If \p val is non-zero, the return value is the largest integer
625 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
626 - If \p val is zero, an integer value is returned that is at least
627 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
628 of bits of the type of the argument. */
629int countlsur (unsigned fract val);
630
631/** \ingroup avr_stdfix
632 - If \p val is non-zero, the return value is the largest integer
633 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
634 - If \p val is zero, an integer value is returned that is at least
635 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
636 of bits of the type of the argument. */
637int countlslr (long fract val);
638
639/** \ingroup avr_stdfix
640 - If \p val is non-zero, the return value is the largest integer
641 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
642 - If \p val is zero, an integer value is returned that is at least
643 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
644 of bits of the type of the argument. */
645int countlsulr (unsigned long fract val);
646
647/** \ingroup avr_stdfix
648 - If \p val is non-zero, the return value is the largest integer
649 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
650 - If \p val is zero, an integer value is returned that is at least
651 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
652 of bits of the type of the argument. */
653int countlsllr (long long fract val);
654
655/** \ingroup avr_stdfix
656 - If \p val is non-zero, the return value is the largest integer
657 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
658 - If \p val is zero, an integer value is returned that is at least
659 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
660 of bits of the type of the argument. */
661int countlsullr (unsigned long long fract val);
662
663/** \ingroup avr_stdfix
664 - If \p val is non-zero, the return value is the largest integer
665 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
666 - If \p val is zero, an integer value is returned that is at least
667 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
668 of bits of the type of the argument. */
669int countlshk (short accum val);
670
671/** \ingroup avr_stdfix
672 - If \p val is non-zero, the return value is the largest integer
673 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
674 - If \p val is zero, an integer value is returned that is at least
675 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
676 of bits of the type of the argument. */
677int countlsuhk (unsigned short accum val);
678
679/** \ingroup avr_stdfix
680 - If \p val is non-zero, the return value is the largest integer
681 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
682 - If \p val is zero, an integer value is returned that is at least
683 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
684 of bits of the type of the argument. */
685int countlsk (accum val);
686
687/** \ingroup avr_stdfix
688 - If \p val is non-zero, the return value is the largest integer
689 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
690 - If \p val is zero, an integer value is returned that is at least
691 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
692 of bits of the type of the argument. */
693int countlsuk (unsigned accum val);
694
695/** \ingroup avr_stdfix
696 - If \p val is non-zero, the return value is the largest integer
697 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
698 - If \p val is zero, an integer value is returned that is at least
699 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
700 of bits of the type of the argument. */
701int countlslk (long accum val);
702
703/** \ingroup avr_stdfix
704 - If \p val is non-zero, the return value is the largest integer
705 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
706 - If \p val is zero, an integer value is returned that is at least
707 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
708 of bits of the type of the argument. */
709int countlsulk (unsigned long accum val);
710
711/** \ingroup avr_stdfix
712 - If \p val is non-zero, the return value is the largest integer
713 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
714 - If \p val is zero, an integer value is returned that is at least
715 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
716 of bits of the type of the argument. */
717int countlsllk (long long accum val);
718
719/** \ingroup avr_stdfix
720 - If \p val is non-zero, the return value is the largest integer
721 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
722 - If \p val is zero, an integer value is returned that is at least
723 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
724 of bits of the type of the argument. */
725int countlsullk (unsigned long long accum val);
726
727#endif /* Doxygen */
728
729/*
730 * The functions below compute the result of the multiplication or division
731 * operation on the operands with the indicated types, and return a value with
732 * the indicated type. The return value is rounded towards zero, and is
733 * saturated on overflow. If the second operand of one of the divide
734 * functions is zero, the behavior is undefined.
735 */
736
737/** \name Division */
738
739/** \ingroup avr_stdfix
740 The rdivi() function computes the value \c num/denom and returns the
741 result of the \c fract type.
742 The return value is rounded towards zero, and is saturated on overflow.
743 If \c denom is zero, the behavior is undefined.
744 \since AVR-LibC v2.3
745*/
746__ATTR_CONST__
747extern fract rdivi (int num, int denom);
748
749/** \ingroup avr_stdfix
750 The lrdivi() function computes the value of \c num/denom and returns the
751 result of the long fract type.
752 The return value is rounded towards zero, and is saturated on overflow.
753 If \c denom is zero, the behavior is undefined.
754 \since AVR-LibC v2.3
755*/
756__ATTR_CONST__
757extern long fract lrdivi (long int num, long int denom);
758
759/** \ingroup avr_stdfix
760 The urdivi() function computes the value \c num/denom and returns the
761 result of the \c unsigned \c fract type.
762 The return value is rounded towards zero, and is saturated on overflow.
763 If \c denom is zero, the behavior is undefined.
764 \since AVR-LibC v2.3
765*/
766__ATTR_CONST__
767extern unsigned fract urdivi (unsigned int num, unsigned int denom);
768
769/** \ingroup avr_stdfix
770 The ulrdivi() function computes the value of \c num/denom and returns the
771 result of the <tt>unsigned long fract</tt> type.
772 The return value is rounded towards zero, and is saturated on overflow.
773 If \c denom is zero, the behavior is undefined.
774 \since AVR-LibC v2.3
775*/
776__ATTR_CONST__
777extern unsigned long fract
778ulrdivi (unsigned long int num, unsigned long int denom);
779
780
781/* AVR-LibC extensions for mathematical functions on fixed-point numbers. */
782
783/* Fixed-point square roots using integer arithmetics.
784 * See "Fast Integer Square Root" by Ross M. Fosler, Microchip DS91040 (2000).
785 */
786
787#ifdef __DOXYGEN__
788/** \name Rounding */
789
790/** \ingroup avr_stdfix
791 Round \p val to \p bit fractional bits. When the result does not
792 fit into the range of the return type, the result is saturated. */
793short fract roundhr (short fract val, int bit);
794
795/** \ingroup avr_stdfix
796 Round \p val to \p bit fractional bits. When the result does not
797 fit into the range of the return type, the result is saturated. */
798unsigned short fract rounduhr (unsigned short fract val, int bit);
799
800/** \ingroup avr_stdfix
801 Round \p val to \p bit fractional bits. When the result does not
802 fit into the range of the return type, the result is saturated. */
803fract roundr (fract val, int bit);
804
805/** \ingroup avr_stdfix
806 Round \p val to \p bit fractional bits. When the result does not
807 fit into the range of the return type, the result is saturated. */
808unsigned fract roundur (unsigned fract val, int bit);
809
810/** \ingroup avr_stdfix
811 Round \p val to \p bit fractional bits. When the result does not
812 fit into the range of the return type, the result is saturated. */
813long fract roundlr (long fract val, int bit);
814
815/** \ingroup avr_stdfix
816 Round \p val to \p bit fractional bits. When the result does not
817 fit into the range of the return type, the result is saturated. */
818unsigned long fract roundulr (unsigned long fract val, int bit);
819
820/** \ingroup avr_stdfix
821 Round \p val to \p bit fractional bits. When the result does not
822 fit into the range of the return type, the result is saturated. */
823long long fract roundllr (long long fract val, int bit);
824
825/** \ingroup avr_stdfix
826 Round \p val to \p bit fractional bits. When the result does not
827 fit into the range of the return type, the result is saturated. */
828unsigned long long fract roundullr (unsigned long long fract val, int bit);
829
830/** \ingroup avr_stdfix
831 Round \p val to \p bit fractional bits. When the result does not
832 fit into the range of the return type, the result is saturated.
833
834 As an extension, \p bit may be in the range
835 <tt>-IBIT &lt; bit &lt; FBIT</tt>.
836 For example, <tt>bit = -1</tt> rounds to an even value. */
837short accum roundhk (short accum val, int bit);
838
839/** \ingroup avr_stdfix
840 Round \p val to \p bit fractional bits. When the result does not
841 fit into the range of the return type, the result is saturated.
842
843 As an extension, \p bit may be in the range
844 <tt>-IBIT &lt; bit &lt; FBIT</tt>.
845 For example, <tt>bit = -1</tt> rounds to an even value. */
846unsigned short accum rounduhk (unsigned short accum val, int bit);
847
848/** \ingroup avr_stdfix
849 Round \p val to \p bit fractional bits. When the result does not
850 fit into the range of the return type, the result is saturated.
851
852 As an extension, \p bit may be in the range
853 <tt>-IBIT &lt; bit &lt; FBIT</tt>.
854 For example, <tt>bit = -1</tt> rounds to an even value. */
855accum roundk (accum val, int bit);
856
857/** \ingroup avr_stdfix
858 Round \p val to \p bit fractional bits. When the result does not
859 fit into the range of the return type, the result is saturated.
860
861 As an extension, \p bit may be in the range
862 <tt>-IBIT &lt; bit &lt; FBIT</tt>.
863 For example, <tt>bit = -1</tt> rounds to an even value. */
864unsigned accum rounduk (unsigned accum val, int bit);
865
866/** \ingroup avr_stdfix
867 Round \p val to \p bit fractional bits. When the result does not
868 fit into the range of the return type, the result is saturated.
869
870 As an extension, \p bit may be in the range
871 <tt>-IBIT &lt; bit &lt; FBIT</tt>.
872 For example, <tt>bit = -1</tt> rounds to an even value. */
873long accum roundlk (long accum val, int bit);
874
875/** \ingroup avr_stdfix
876 Round \p val to \p bit fractional bits. When the result does not
877 fit into the range of the return type, the result is saturated.
878
879 As an extension, \p bit may be in the range
880 <tt>-IBIT &lt; bit &lt; FBIT</tt>.
881 For example, <tt>bit = -1</tt> rounds to an even value. */
882unsigned long accum roundulk (unsigned long accum val, int bit);
883
884/** \ingroup avr_stdfix
885 Round \p val to \p bit fractional bits. When the result does not
886 fit into the range of the return type, the result is saturated.
887
888 As an extension, \p bit may be in the range
889 <tt>-IBIT &lt; bit &lt; FBIT</tt>.
890 For example, <tt>bit = -1</tt> rounds to an even value. */
891long long accum roundllk (long long accum val, int bit);
892
893/** \ingroup avr_stdfix
894 Round \p val to \p bit fractional bits. When the result does not
895 fit into the range of the return type, the result is saturated.
896
897 As an extension, \p bit may be in the range
898 <tt>-IBIT &lt; bit &lt; FBIT</tt>.
899 For example, <tt>bit = -1</tt> rounds to an even value. */
900unsigned long long accum roundullk (unsigned long long accum val, int bit);
901
902
903/** \name Square Root and Transcendental Functions */
904
905/** \ingroup avr_stdfix
906 Compute the arcus cosine of \p x.
907 The returned value is in the range
908\htmlonly
909[0, &pi;].
910\endhtmlonly
911\latexonly
912\begin{math} [0, \pi ]\end{math} .
913\endlatexonly
914\manonly
915.EQ
916[0, pi ]
917.EN
918.
919\endmanonly
920 For invalid values of \p x the returned value
921 is -65536 = #kbits (0x80000000).
922
923 The absolute error is bounded by
924\htmlonly
9255.5&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;14.1</sup>.
926\endhtmlonly
927\latexonly
928\begin{math} 5.5\cdot 10^{-5} \approx 2^{-14.1}\end{math} .
929\endlatexonly
930\manonly
931.EQ
9325.5 * 10^{-5} = 2^{-14.1}
933.EN
934.
935\endmanonly
936
937 \since AVR-LibC v2.3 */
938accum acosk (accum x);
939
940/** \ingroup avr_stdfix
941 Compute the arcus cosine of \p x.
942 The returned value is in the range
943\htmlonly
944[0, &pi;/2].
945\endhtmlonly
946\latexonly
947\begin{math} [0, \pi /2]\end{math} .
948\endlatexonly
949\manonly
950.EQ
951[0, pi/2]
952.EN
953.
954\endmanonly
955 For invalid values of \p x the returned value
956 is 32768 = #ukbits (0x80000000).
957
958 The absolute error is bounded by
959\htmlonly
9604.6&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;14.4</sup>.
961\endhtmlonly
962\latexonly
963\begin{math} 4.6\cdot 10^{-5} \approx 2^{-14.4}\end{math} .
964\endlatexonly
965\manonly
966.EQ
9674.6 * 10^{-5} = 2^{-14.4}
968.EN
969.
970\endmanonly
971
972 \since AVR-LibC v2.3 */
973unsigned accum acosuk (unsigned accum x);
974
975/** \ingroup avr_stdfix
976 Compute the arcus sine of \p x.
977 The returned value is in the range
978\htmlonly
979[&minus;&pi;/2, &pi;/2].
980\endhtmlonly
981\latexonly
982\begin{math} [-\pi /2, \pi /2]\end{math} .
983\endlatexonly
984\manonly
985.EQ
986[- pi/2, pi/2]
987.EN
988.
989\endmanonly
990 For invalid values of \p x the returned value
991 is -65536 = #kbits (0x80000000).
992
993 The absolute error is bounded by
994\htmlonly
9955.1&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;14</sup>.
996\endhtmlonly
997\latexonly
998\begin{math} 5.1\cdot 10^{-5} \approx 2^{-14}\end{math} .
999\endlatexonly
1000\manonly
1001.EQ
10025.1 * 10^{-5} = 2^{-14}
1003.EN
1004.
1005\endmanonly
1006
1007 \since AVR-LibC v2.3 */
1008accum asink (accum x);
1009
1010/** \ingroup avr_stdfix
1011 Compute the arcus sine of \p x.
1012 The returned value is in the range
1013\htmlonly
1014[0, &pi;/2].
1015\endhtmlonly
1016\latexonly
1017\begin{math} [0, \pi /2]\end{math} .
1018\endlatexonly
1019\manonly
1020.EQ
1021[0, pi/2]
1022.EN
1023.
1024\endmanonly
1025 For invalid values of \p x the returned value
1026 is 32768 = #ukbits (0x80000000).
1027
1028 The absolute error is bounded by
1029\htmlonly
10304.5&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;14.4</sup>.
1031\endhtmlonly
1032\latexonly
1033\begin{math} 4.5\cdot 10^{-5} \approx 2^{-14.4}\end{math} .
1034\endlatexonly
1035\manonly
1036.EQ
10374.5 * 10^{-5} = 2^{-14.4}
1038.EN
1039.
1040\endmanonly
1041
1042 \since AVR-LibC v2.3 */
1043unsigned accum asinuk (unsigned accum x);
1044
1045/** \ingroup avr_stdfix
1046 Compute the arcus tangent of \p x.
1047 The returned value is in the range
1048\htmlonly
1049(&minus;&pi;/2, &pi;/2&asymp;1.5708).
1050\endhtmlonly
1051\latexonly
1052\begin{math} (-\pi /2, \pi /2\approx 1.5708)\end{math} .
1053\endlatexonly
1054\manonly
1055.EQ
1056(- pi/2, pi/2=1.5708)
1057.EN
1058.
1059\endmanonly
1060
1061 \since AVR-LibC v2.3 */
1062accum atank (accum x);
1063
1064/** \ingroup avr_stdfix
1065 Compute the arcus tangent of \p x.
1066 The returned value is in the range
1067\htmlonly
1068[0, &pi;/2&asymp;1.5708).
1069\endhtmlonly
1070\latexonly
1071\begin{math} [0, \pi /2\approx 1.5708)\end{math} .
1072\endlatexonly
1073\manonly
1074.EQ
1075[0, pi/2=1.5708)
1076.EN
1077.
1078\endmanonly
1079
1080 \since AVR-LibC v2.3 */
1081unsigned accum atanuk (unsigned accum x);
1082
1083/** \ingroup avr_stdfix
1084 Compute the arcus tangent of \p x.
1085 The returned value is in the range
1086\htmlonly
1087[0, &pi;/4&asymp;0.7854].
1088\endhtmlonly
1089\latexonly
1090\begin{math} [0, \pi /4\approx 0.7854]\end{math} .
1091\endlatexonly
1092\manonly
1093.EQ
1094[0, pi/4=0.7854]
1095.EN
1096.
1097\endmanonly
1098
1099 The absolute error is bounded by
1100\htmlonly
11012.6&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;15</sup>.
1102\endhtmlonly
1103\latexonly
1104\begin{math} 2.6\cdot 10^{-5} \approx 2^{-15}\end{math} .
1105\endlatexonly
1106\manonly
1107.EQ
11082.6 * 10^{-5} = 2^{-15}
1109.EN
1110.
1111\endmanonly
1112 The worst case execution time (WCET) is around 210 cycles when MUL is
1113 available, and around 1000 cycles when MUL is not available
1114 (measured with avr-gcc v15).
1115 \since AVR-LibC v2.3 */
1116unsigned fract atanur (unsigned fract x);
1117
1118/** \ingroup avr_stdfix
1119 Compute
1120\htmlonly
11212<sup>x</sup>
1122\endhtmlonly
1123\latexonly
1124\begin{math} 2^{x}\end{math}
1125\endlatexonly
1126\manonly
1127.EQ
11282^x
1129.EN
1130\endmanonly
1131 with saturation.
1132
1133 The WCET is at least the one of exp2m1ur().
1134 \since AVR-LibC v2.3 */
1135accum exp2k (accum x);
1136
1137/** \ingroup avr_stdfix
1138 Compute
1139\htmlonly
11402<sup>x</sup>
1141\endhtmlonly
1142\latexonly
1143\begin{math} 2^{x}\end{math}
1144\endlatexonly
1145\manonly
1146.EQ
11472^x
1148.EN
1149\endmanonly
1150 with saturation.
1151
1152 The WCET is at least the one of exp2m1ur().
1153 \since AVR-LibC v2.3 */
1154unsigned accum exp2uk (unsigned accum x);
1155
1156/** \ingroup avr_stdfix
1157 Compute
1158\htmlonly
11592<sup>x</sup>&nbsp;&minus;&nbsp;1.
1160\endhtmlonly
1161\latexonly
1162\begin{math} 2^{x} - 1\end{math} .
1163\endlatexonly
1164\manonly
1165.EQ
11662^x - 1
1167.EN
1168.
1169\endmanonly
1170 The returned value is in the range [0, 1).
1171
1172 The absolute error is bounded by
1173\htmlonly
11742.2&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;15.4</sup>.
1175\endhtmlonly
1176\latexonly
1177\begin{math} 2.2\cdot 10^{-5} \approx 2^{-15.4}\end{math} .
1178\endlatexonly
1179\manonly
1180.EQ
11812.2 * 10^{-5} = 2^{-15.4}
1182.EN
1183.
1184\endmanonly
1185 The worst case execution time (WCET) is around 200 cycles when MUL is
1186 available, and around 1000 cycles when MUL is not available
1187 (measured with avr-gcc v15).
1188 \since AVR-LibC v2.3 */
1189unsigned fract exp2m1ur (unsigned fract x);
1190
1191/** \ingroup avr_stdfix
1192 Returns
1193\htmlonly
1194log<sub>2</sub>(x),
1195\endhtmlonly
1196\latexonly
1197\begin{math} \log _{2}(x)\end{math} ,
1198\endlatexonly
1199\manonly
1200.EQ
1201log_2(x)
1202.EN
1203,
1204\endmanonly
1205 the logarithm to base 2 of the value \p x.
1206 The returned value for \p x = 0 is -32768.
1207
1208 The absolute error is bounded by
1209\htmlonly
12104.5&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;14.5</sup>.
1211\endhtmlonly
1212\latexonly
1213\begin{math} 4.5\cdot 10^{-5} \approx 2^{-14.5}\end{math} .
1214\endlatexonly
1215\manonly
1216.EQ
12174.5 * 10^{-5} = 2^{-14.5}
1218.EN
1219.
1220\endmanonly
1221 The worst case execution time (WCET) is around 150 cycles more
1222 than the WCET of log21pur().
1223 \since AVR-LibC v2.3 */
1224accum log2uk(unsigned accum x);
1225
1226/** \ingroup avr_stdfix
1227 Return
1228\htmlonly
1229log<sub>2</sub>(x),
1230\endhtmlonly
1231\latexonly
1232\begin{math} \log _{2}(x)\end{math} ,
1233\endlatexonly
1234\manonly
1235.EQ
1236log_2(x)
1237.EN
1238,
1239\endmanonly
1240 the logarithm to base 2 of the value \p x.
1241 The returned value for \p x = 0 is -128.
1242
1243 The absolute error is bounded by
1244\htmlonly
12458&middot;10<sup>&minus;3</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;7</sup>.
1246\endhtmlonly
1247\latexonly
1248\begin{math} 8\cdot 10^{-3} \approx 2^{-7}\end{math} .
1249\endlatexonly
1250\manonly
1251.EQ
12528 * 10^{-3} = 2^{-7}
1253.EN
1254.
1255\endmanonly
1256 The worst case execution time (WCET) is around 60 cycles plus
1257 the WCET of log21puhr().
1258 \since AVR-LibC v2.3 */
1259short accum log2uhk(unsigned short accum x);
1260
1261/** \ingroup avr_stdfix
1262 Return
1263\htmlonly
1264log<sub>2</sub>(1 + x),
1265\endhtmlonly
1266\latexonly
1267\begin{math} \log _{2}(1 + x)\end{math} ,
1268\endlatexonly
1269\manonly
1270.EQ
1271log_2(1 + x)
1272.EN
1273,
1274\endmanonly
1275 the logarithm to base 2 of the value 1 + \p x.
1276 The result is in the range [0, 1).
1277
1278 The absolute error is bounded by
1279\htmlonly
12804.3&middot;10<sup>&minus;3</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;7.5</sup>.
1281\endhtmlonly
1282\latexonly
1283\begin{math} 4.3\cdot 10^{-3} \approx 2^{-7.5}\end{math} .
1284\endlatexonly
1285\manonly
1286.EQ
12874.3 * 10^{-3} = 2^{-7.5}
1288.EN
1289.
1290\endmanonly
1291 The worst case execution time (WCET) is around 25 cycles when MUL is
1292 available, and around 340 cycles when MUL is not available.
1293 \since AVR-LibC v2.3 */
1294unsigned short fract log21puhr(unsigned short fract x);
1295
1296/** \ingroup avr_stdfix
1297 Return
1298\htmlonly
1299log<sub>2</sub>(1 + x),
1300\endhtmlonly
1301\latexonly
1302\begin{math} \log _{2}(1 + x)\end{math} ,
1303\endlatexonly
1304\manonly
1305.EQ
1306log_2(1 + x)
1307.EN
1308,
1309\endmanonly
1310 the logarithm to base 2 of the value 1 + \p x.
1311 The result is in the range [0, 1).
1312
1313 The absolute error is bounded by
1314\htmlonly
13153&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;15</sup>.
1316\endhtmlonly
1317\latexonly
1318\begin{math} 3\cdot 10^{-5} \approx 2^{-15}\end{math} .
1319\endlatexonly
1320\manonly
1321.EQ
13223 * 10^{-5} = 2^{-15}
1323.EN
1324.
1325\endmanonly
1326 The worst case execution time (WCET) is around 250 cycles when MUL is
1327 available, and around 1300 cycles when MUL is not available.
1328 \since AVR-LibC v2.3 */
1329unsigned fract log21pur(unsigned fract x);
1330
1331/** \ingroup avr_stdfix
1332 Cosine of
1333\htmlonly
1334x&middot;&pi;/2
1335\endhtmlonly
1336\latexonly
1337\begin{math} x\cdot \pi /2\end{math}
1338\endlatexonly
1339\manonly
1340.EQ
1341x * pi/2
1342.EN
1343\endmanonly
1344 radians.
1345
1346 The absolute error is bounded by
1347\htmlonly
13484.6&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;14.4</sup>.
1349\endhtmlonly
1350\latexonly
1351\begin{math} 4.6\cdot 10^{-5} \approx 2^{-14.4}\end{math} .
1352\endlatexonly
1353\manonly
1354.EQ
13554.6 * 10^{-5} = 2^{-14.4}
1356.EN
1357.
1358\endmanonly
1359 The worst case execution time (WCET) is around 300 cycles when MUL is
1360 available, and around 1400 cycles when MUL is not available.
1361 \since AVR-LibC v2.3 */
1362accum cospi2k(accum deg);
1363
1364/** \ingroup avr_stdfix
1365 Sine of
1366\htmlonly
1367x&middot;&pi;/2
1368\endhtmlonly
1369\latexonly
1370\begin{math} x\cdot \pi /2\end{math}
1371\endlatexonly
1372\manonly
1373.EQ
1374x * pi/2
1375.EN
1376\endmanonly
1377 radians.
1378
1379 The absolute error is bounded by
1380\htmlonly
13814.6&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;14.4</sup>.
1382\endhtmlonly
1383\latexonly
1384\begin{math} 4.6\cdot 10^{-5} \approx 2^{-14.4}\end{math} .
1385\endlatexonly
1386\manonly
1387.EQ
13884.6 * 10^{-5} = 2^{-14.4}
1389.EN
1390.
1391\endmanonly
1392 The worst case execution time (WCET) is around 300 cycles when MUL is
1393 available, and around 1400 cycles when MUL is not available.
1394 \since AVR-LibC v2.3 */
1395accum sinpi2k(accum deg);
1396
1397/** \ingroup avr_stdfix
1398 Sine of the angle \a deg where \a deg is specified in degrees, i.e.
1399 in the range
1400\htmlonly
1401[0&deg;, 256&deg;).
1402\endhtmlonly
1403\latexonly
1404\begin{math} [0^\circ , 256^\circ )\end{math} .
1405\endlatexonly
1406\manonly
1407.EQ
1408[0 degree, 256 degree)
1409.EN
1410.
1411\endmanonly
1412 The returned value is in the range (-1, +1), i.e. is never -1.
1413
1414 The absolute error is bounded by
1415\htmlonly
14166.5&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;13.9</sup>.
1417\endhtmlonly
1418\latexonly
1419\begin{math} 6.5\cdot 10^{-5} \approx 2^{-13.9}\end{math} .
1420\endlatexonly
1421\manonly
1422.EQ
14236.5 * 10^{-5} = 2^{-13.9}
1424.EN
1425.
1426\endmanonly
1427 The worst case execution time (WCET) is around 70 cycles.
1428 \since AVR-LibC v2.3 */
1429fract sinuhk_deg(unsigned short accum deg);
1430
1431/** \ingroup avr_stdfix
1432 Cosine of the angle \a deg where \a deg is specified in degrees, i.e.
1433 in the range
1434\htmlonly
1435[0&deg;, 256&deg;).
1436\endhtmlonly
1437\latexonly
1438\begin{math} [0^\circ , 256^\circ )\end{math} .
1439\endlatexonly
1440\manonly
1441.EQ
1442[0 degree, 256 degree)
1443.EN
1444.
1445\endmanonly
1446 The returned value is in the range (-1, +1), i.e. is never -1.
1447
1448 The absolute error is bounded by
1449\htmlonly
14506.5&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;13.9</sup>.
1451\endhtmlonly
1452\latexonly
1453\begin{math} 6.5\cdot 10^{-5} \approx 2^{-13.9}\end{math} .
1454\endlatexonly
1455\manonly
1456.EQ
14576.5 * 10^{-5} = 2^{-13.9}
1458.EN
1459.
1460\endmanonly
1461 The worst case execution time (WCET) is around 90 cycles.
1462 \since AVR-LibC v2.3 */
1463fract cosuhk_deg(unsigned short accum deg);
1464
1465/** \ingroup avr_stdfix
1466 Sine of
1467\htmlonly
1468x&middot;&pi;/2
1469\endhtmlonly
1470\latexonly
1471\begin{math} x\cdot \pi /2\end{math}
1472\endlatexonly
1473\manonly
1474.EQ
1475x * pi/2
1476.EN
1477\endmanonly
1478 redians.
1479 The returned value is in the range [0, 1).
1480
1481 The absolute error is bounded by
1482\htmlonly
14832.9&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;15</sup>.
1484\endhtmlonly
1485\latexonly
1486\begin{math} 2.9\cdot 10^{-5} \approx 2^{-15}\end{math} .
1487\endlatexonly
1488\manonly
1489.EQ
14902.9 * 10^{-5} = 2^{-15}
1491.EN
1492.
1493\endmanonly
1494 The worst case execution time (WCET) is around 260 cycles when MUL is
1495 available, and around 1400 cycles when MUL is not available.
1496 \since AVR-LibC v2.3 */
1497unsigned fract sinpi2ur(unsigned fract x);
1498
1499/** \ingroup avr_stdfix
1500 Square root of the value \p radic. Negative values are returned unchanged.
1501 The worst case execution time (WCET) is around 310 cycles.
1502 \since AVR-LibC v2.3 */
1503short accum sqrthk(short accum radic);
1504
1505/** \ingroup avr_stdfix
1506 Square root of the value \p radic rounded down.
1507 \since AVR-LibC v2.3 */
1508short fract sqrthr(short fract radic);
1509
1510/** \ingroup avr_stdfix
1511 Square root of the value \p radic. Negative values are returned unchanged.
1512 The worst case execution time (WCET) is around 640 cycles.
1513 \since AVR-LibC v2.3 */
1514accum sqrtk(accum radic);
1515
1516/** \ingroup avr_stdfix
1517 Square root of the value \p radic. Negative values are returned unchanged.
1518 The worst case execution time (WCET) is around 1080 cycles.
1519 \since AVR-LibC v2.3 */
1520long fract sqrtlr(long fract radic);
1521
1522/** \ingroup avr_stdfix
1523 Square root of the value \p radic. Negative values are returned unchanged.
1524 The worst case execution time (WCET) is around 320 cycles.
1525 \since AVR-LibC v2.3 */
1526fract sqrtr(fract radic);
1527
1528/** \ingroup avr_stdfix
1529 Square root of the value \p radic rounded down.
1530 The worst case execution time (WCET) is around 300 cycles.
1531 \since AVR-LibC v2.3 */
1532unsigned short accum sqrtuhk(unsigned short accum radic);
1533
1534/** \ingroup avr_stdfix
1535 Square root of the value \p radic rounded down.
1536 The result is in the range [0, 1).
1537
1538 The absolute error is in the range
1539\htmlonly
1540[&minus;3.9&middot;10<sup>&minus;3</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;8</sup>, 0].
1541\endhtmlonly
1542\latexonly
1543\begin{math} [-3.9\cdot 10^{-3} \approx 2^{-8}, 0]\end{math} .
1544\endlatexonly
1545\manonly
1546.EQ
1547[-3.9 * 10^{-3} = 2^{-8}, 0]
1548.EN
1549.
1550\endmanonly
1551 The worst case execution time (WCET) is around 120 cycles.
1552 \since AVR-LibC v2.3 */
1553unsigned short fract sqrtuhr(unsigned short fract radic);
1554
1555/** \ingroup avr_stdfix
1556 Square root of the value \p radic.
1557 The worst case execution time (WCET) is around 620 cycles.
1558 \since AVR-LibC v2.3 */
1559unsigned accum sqrtuk(unsigned accum radic);
1560
1561
1562/** \ingroup avr_stdfix
1563 Square root of the value \p radic. The result is in the range [0, 1).
1564 The worst case execution time (WCET) is around 1060 cycles.
1565 \since AVR-LibC v2.3 */
1566unsigned long fract sqrtulr(unsigned long fract radic);
1567
1568/** \ingroup avr_stdfix
1569 Square root of the value \p radic. The result is in the range [0, 1).
1570
1571 The absolute error is in the range
1572\htmlonly
1573[&minus;1.5&middot;10<sup>&minus;5</sup>&nbsp;&asymp;&nbsp;2<sup>&minus;16</sup>, 0].
1574\endhtmlonly
1575\latexonly
1576\begin{math} [-1.5\cdot 10^{-5} \approx 2^{-16}, 0]\end{math} .
1577\endlatexonly
1578\manonly
1579.EQ
1580[-1.5 * 10^{-5} = 2^{-16}, 0]
1581.EN
1582.
1583\endmanonly
1584 The worst case execution time (WCET) is around 320 cycles.
1585 \since AVR-LibC v2.3 */
1586unsigned fract sqrtur(unsigned fract radic);
1587
1588
1589/** \name Type-Generic Functions */
1590
1591/** \ingroup avr_stdfix
1592 Computes the absolute value of fixed-point value \p val.
1593 When the result does not fit into the range of the return type,
1594 the result is saturated. */
1595type absfx (type val);
1596
1597/** \ingroup avr_stdfix
1598 - If \p val is non-zero, the return value is the largest integer
1599 \c k for which the expression <tt>val &lt;&lt; k</tt> does not overflow.
1600 - If \p val is zero, an integer value is returned that is at least
1601 as large as <tt>N - 1</tt>, where <tt>N</tt> is the total number
1602 of bits of the type of the argument. */
1603int countlsfx (type val);
1604
1605/** \ingroup avr_stdfix
1606 Round \p val to \p bit fractional bits. When the result does not
1607 fit into the range of the return type, the result is saturated.
1608
1609 As an extension, \p bit may be in the range
1610 <tt>-IBIT &lt; bit &lt; FBIT</tt>.
1611 For example, <tt>bit = -1</tt> rounds to an even value. */
1612type roundfx (type val, int bit);
1613
1614#else /* Doxygen */
1615extern unsigned accum acosuk(unsigned accum) __ATTR_CONST__;
1616extern unsigned accum asinuk(unsigned accum) __ATTR_CONST__;
1617extern unsigned accum atanuk(unsigned accum) __ATTR_CONST__;
1618extern accum acosk(accum) __ATTR_CONST__;
1619extern accum asink(accum) __ATTR_CONST__;
1620extern accum atank(accum) __ATTR_CONST__;
1621extern unsigned fract atanur(unsigned fract) __ATTR_CONST__;
1622
1623extern short fract sqrthr(short fract) __asm__("__sqrthr") __ATTR_CONST__;
1624extern unsigned short fract sqrtuhr(unsigned short fract) __asm__("__sqrtuhr") __ATTR_CONST__;
1625fract sqrtr(fract) __ATTR_CONST__;
1626unsigned fract sqrtur(unsigned fract) __ATTR_CONST__;
1627long fract sqrtlr(long fract) __ATTR_CONST__;
1628unsigned long fract sqrtulr(unsigned long fract) __ATTR_CONST__;
1629unsigned accum sqrtuk(unsigned accum) __ATTR_CONST__;
1630accum sqrtk(accum) __ATTR_CONST__;
1631short accum sqrthk(short accum) __ATTR_CONST__;
1632unsigned short accum sqrtuhk(unsigned short accum) __ATTR_CONST__;
1633
1634extern unsigned short fract log21puhr(unsigned short fract) __ATTR_CONST__;
1635extern unsigned fract log21pur(unsigned fract) __ATTR_CONST__;
1636extern accum log2uk(unsigned accum) __ATTR_CONST__;
1637extern short accum log2uhk(unsigned short accum) __ATTR_CONST__;
1638
1639extern fract sinuhk_deg(unsigned short accum) __ATTR_CONST__;
1640extern fract cosuhk_deg(unsigned short accum) __ATTR_CONST__;
1641extern unsigned fract sinpi2ur(unsigned fract) __ATTR_CONST__;
1642extern accum sinpi2k(accum) __ATTR_CONST__;
1643extern accum cospi2k(accum) __ATTR_CONST__;
1644
1645extern accum exp2k (accum) __ATTR_CONST__;
1646extern unsigned accum exp2uk (unsigned accum) __ATTR_CONST__;
1647extern unsigned fract exp2m1ur (unsigned fract) __ATTR_CONST__;
1648
1649extern char* uktoa (unsigned accum, char*, unsigned char);
1650extern char* urtoa (unsigned fract, char*, unsigned char);
1651extern char* ktoa (accum, char*, unsigned char);
1652extern char* rtoa (fract, char*, unsigned char);
1653extern char* uhktoa (unsigned short accum, char*, unsigned char);
1654extern char* uhrtoa (unsigned short fract, char*, unsigned char);
1655extern char* hktoa (short accum, char*, unsigned char);
1656extern char* hrtoa (short fract, char*, unsigned char);
1657#endif /* Doxygen */
1658
1659#ifdef __DOXYGEN__
1660/** \name Functions reading from PROGMEM */
1661
1662/** \ingroup avr_stdfix
1663 Read a <tt>short fract</tt> from 16-bit address \p addr.
1664 The address is in the lower 64 KiB of program memory.
1665 \since AVR-LibC v2.3 */
1666static inline short fract pgm_read_hr (const short fract *addr);
1667
1668/** \ingroup avr_stdfix
1669 Read an <tt>unsigned short fract</tt> from 16-bit address \p addr.
1670 The address is in the lower 64 KiB of program memory.
1671 \since AVR-LibC v2.3 */
1672static inline unsigned short fract pgm_read_uhr (const unsigned short fract *addr);
1673
1674/** \ingroup avr_stdfix
1675 Read a <tt>fract</tt> from 16-bit address \p addr.
1676 The address is in the lower 64 KiB of program memory.
1677 \since AVR-LibC v2.3 */
1678static inline fract pgm_read_r (const fract *addr);
1679
1680/** \ingroup avr_stdfix
1681 Read an <tt>unsigned fract</tt> from 16-bit address \p addr.
1682 The address is in the lower 64 KiB of program memory.
1683 \since AVR-LibC v2.3 */
1684static inline unsigned fract pgm_read_ur (const unsigned fract *addr);
1685
1686/** \ingroup avr_stdfix
1687 Read a <tt>long fract</tt> from 16-bit address \p addr.
1688 The address is in the lower 64 KiB of program memory.
1689 \since AVR-LibC v2.3 */
1690static inline long fract pgm_read_lr (const long fract *addr);
1691
1692/** \ingroup avr_stdfix
1693 Read an <tt>unsigned long fract</tt> from 16-bit address \p addr.
1694 The address is in the lower 64 KiB of program memory.
1695 \since AVR-LibC v2.3 */
1696static inline unsigned long fract pgm_read_ulr (const unsigned long fract *addr);
1697
1698/** \ingroup avr_stdfix
1699 Read a <tt>long long fract</tt> from 16-bit address \p addr.
1700 The address is in the lower 64 KiB of program memory.
1701 \since AVR-LibC v2.3 */
1702static inline long long fract pgm_read_llr (const long long fract *addr);
1703
1704/** \ingroup avr_stdfix
1705 Read an <tt>unsigned long long fract</tt> from 16-bit address \p addr.
1706 The address is in the lower 64 KiB of program memory.
1707 \since AVR-LibC v2.3 */
1708static inline unsigned long long fract pgm_read_ullr (const unsigned long long fract *addr);
1709
1710/** \ingroup avr_stdfix
1711 Read a <tt>short accum</tt> from 16-bit address \p addr.
1712 The address is in the lower 64 KiB of program memory.
1713 \since AVR-LibC v2.3 */
1714static inline short accum pgm_read_hk (const short accum *addr);
1715
1716/** \ingroup avr_stdfix
1717 Read an <tt>unsigned short accum</tt> from 16-bit address \p addr.
1718 The address is in the lower 64 KiB of program memory.
1719 \since AVR-LibC v2.3 */
1720static inline unsigned short accum pgm_read_uhk (const unsigned short accum *addr);
1721
1722/** \ingroup avr_stdfix
1723 Read an <tt>accum</tt> from 16-bit address \p addr.
1724 The address is in the lower 64 KiB of program memory.
1725 \since AVR-LibC v2.3 */
1726static inline accum pgm_read_k (const accum *addr);
1727
1728/** \ingroup avr_stdfix
1729 Read an <tt>unsigned accum</tt> from 16-bit address \p addr.
1730 The address is in the lower 64 KiB of program memory.
1731 \since AVR-LibC v2.3 */
1732static inline unsigned accum pgm_read_uk (const unsigned accum *addr);
1733
1734/** \ingroup avr_stdfix
1735 Read a <tt>long accum</tt> from 16-bit address \p addr.
1736 The address is in the lower 64 KiB of program memory.
1737 \since AVR-LibC v2.3 */
1738static inline long accum pgm_read_lk (const long accum *addr);
1739
1740/** \ingroup avr_stdfix
1741 Read an <tt>unsigned long accum</tt> from 16-bit address \p addr.
1742 The address is in the lower 64 KiB of program memory.
1743 \since AVR-LibC v2.3 */
1744static inline unsigned long accum pgm_read_ulk (const unsigned long accum *addr);
1745
1746/** \ingroup avr_stdfix
1747 Read a <tt>long long accum</tt> from 16-bit address \p addr.
1748 The address is in the lower 64 KiB of program memory.
1749 \since AVR-LibC v2.3 */
1750static inline long long accum pgm_read_llk (const long long accum *addr);
1751
1752/** \ingroup avr_stdfix
1753 Read an <tt>unsigned long long accum</tt> from 16-bit address \p addr.
1754 The address is in the lower 64 KiB of program memory.
1755 \since AVR-LibC v2.3 */
1756static inline unsigned long long accum pgm_read_ullk (const unsigned long long accum *addr);
1757
1758#else /* Doxygen */
1759
1760#include <avr/pgmspace.h>
1761
1762_Avrlibc_Def_Pgm_1 (hr, short fract)
1763_Avrlibc_Def_Pgm_1 (uhr, unsigned short fract)
1764_Avrlibc_Def_Pgm_2 (r, fract)
1765_Avrlibc_Def_Pgm_2 (ur, unsigned fract)
1766_Avrlibc_Def_Pgm_4 (lr, long fract)
1767_Avrlibc_Def_Pgm_4 (ulr, unsigned long fract)
1768_Avrlibc_Def_Pgm_8 (llr, long long fract)
1769_Avrlibc_Def_Pgm_8 (ullr, unsigned long long fract)
1770
1771_Avrlibc_Def_Pgm_2 (hk, short accum)
1772_Avrlibc_Def_Pgm_2 (uhk, unsigned short accum)
1773_Avrlibc_Def_Pgm_4 (k, accum)
1774_Avrlibc_Def_Pgm_4 (uk, unsigned accum)
1775_Avrlibc_Def_Pgm_8 (lk, long accum)
1776_Avrlibc_Def_Pgm_8 (ulk, unsigned long accum)
1777_Avrlibc_Def_Pgm_8 (llk, long long accum)
1778_Avrlibc_Def_Pgm_8 (ullk, unsigned long long accum)
1779#endif /* Doxygen */
1780
1781#ifdef __DOXYGEN__
1782/** \name Functions reading from PROGMEM_FAR */
1783
1784/** \ingroup avr_stdfix
1785 Read a <tt>short fract</tt> from far address \p addr.
1786 The address is in the program memory.
1787 \since AVR-LibC v2.3 */
1788static inline short fract pgm_read_hr_far (uint_farptr_t addr);
1789
1790/** \ingroup avr_stdfix
1791 Read an <tt>unsigned short fract</tt> from far address \p addr.
1792 The address is in the program memory.
1793 \since AVR-LibC v2.3 */
1794static inline unsigned short fract pgm_read_uhr_far (uint_farptr_t addr);
1795
1796/** \ingroup avr_stdfix
1797 Read a <tt>fract</tt> from far address \p addr.
1798 The address is in the program memory.
1799 \since AVR-LibC v2.3 */
1800static inline fract pgm_read_r_far (uint_farptr_t addr);
1801
1802/** \ingroup avr_stdfix
1803 Read an <tt>unsigned fract</tt> from far address \p addr.
1804 The address is in the program memory.
1805 \since AVR-LibC v2.3 */
1806static inline unsigned fract pgm_read_ur_far (uint_farptr_t addr);
1807
1808/** \ingroup avr_stdfix
1809 Read a <tt>long fract</tt> from far address \p addr.
1810 The address is in the program memory.
1811 \since AVR-LibC v2.3 */
1812static inline long fract pgm_read_lr_far (uint_farptr_t addr);
1813
1814/** \ingroup avr_stdfix
1815 Read an <tt>unsigned long fract</tt> from far address \p addr.
1816 The address is in the program memory.
1817 \since AVR-LibC v2.3 */
1818static inline unsigned long fract pgm_read_ulr_far (uint_farptr_t addr);
1819
1820/** \ingroup avr_stdfix
1821 Read a <tt>long long fract</tt> from far address \p addr.
1822 The address is in the program memory.
1823 \since AVR-LibC v2.3 */
1824static inline long long fract pgm_read_llr_far (uint_farptr_t addr);
1825
1826/** \ingroup avr_stdfix
1827 Read an <tt>unsigned long long fract</tt> from far address \p addr.
1828 The address is in the program memory.
1829 \since AVR-LibC v2.3 */
1830static inline unsigned long long fract pgm_read_ullr_far (uint_farptr_t addr);
1831
1832/** \ingroup avr_stdfix
1833 Read a <tt>short accum</tt> from far address \p addr.
1834 The address is in the program memory.
1835 \since AVR-LibC v2.3 */
1836static inline short accum pgm_read_hk_far (uint_farptr_t addr);
1837
1838/** \ingroup avr_stdfix
1839 Read an <tt>unsigned short accum</tt> from far address \p addr.
1840 The address is in the program memory.
1841 \since AVR-LibC v2.3 */
1842static inline unsigned short accum pgm_read_uhk_far (uint_farptr_t addr);
1843
1844/** \ingroup avr_stdfix
1845 Read an <tt>accum</tt> from far address \p addr.
1846 The address is in the program memory.
1847 \since AVR-LibC v2.3 */
1848static inline accum pgm_read_k_far (uint_farptr_t addr);
1849
1850/** \ingroup avr_stdfix
1851 Read an <tt>unsigned accum</tt> from far address \p addr.
1852 The address is in the program memory.
1853 \since AVR-LibC v2.3 */
1854static inline unsigned accum pgm_read_uk_far (uint_farptr_t addr);
1855
1856/** \ingroup avr_stdfix
1857 Read a <tt>long accum</tt> from far address \p addr.
1858 The address is in the program memory.
1859 \since AVR-LibC v2.3 */
1860static inline long accum pgm_read_lk_far (uint_farptr_t addr);
1861
1862/** \ingroup avr_stdfix
1863 Read an <tt>unsigned long accum</tt> from far address \p addr.
1864 The address is in the program memory.
1865 \since AVR-LibC v2.3 */
1866static inline unsigned long accum pgm_read_ulk_far (uint_farptr_t addr);
1867
1868/** \ingroup avr_stdfix
1869 Read a <tt>long long accum</tt> from far address \p addr.
1870 The address is in the program memory.
1871 \since AVR-LibC v2.3 */
1872static inline long long accum pgm_read_llk_far (uint_farptr_t addr);
1873
1874/** \ingroup avr_stdfix
1875 Read an <tt>unsigned long long accum</tt> from far address \p addr.
1876 The address is in the program memory.
1877 \since AVR-LibC v2.3 */
1878static inline unsigned long long accum pgm_read_ullk_far (uint_farptr_t addr);
1879
1880#else /* Doxygen */
1881
1882_Avrlibc_Def_Pgm_Far_1 (hr, short fract)
1883_Avrlibc_Def_Pgm_Far_1 (uhr, unsigned short fract)
1884_Avrlibc_Def_Pgm_Far_2 (r, fract)
1885_Avrlibc_Def_Pgm_Far_2 (ur, unsigned fract)
1886_Avrlibc_Def_Pgm_Far_4 (lr, long fract)
1887_Avrlibc_Def_Pgm_Far_4 (ulr, unsigned long fract)
1888_Avrlibc_Def_Pgm_Far_8 (llr, long long fract)
1889_Avrlibc_Def_Pgm_Far_8 (ullr, unsigned long long fract)
1890
1891_Avrlibc_Def_Pgm_Far_2 (hk, short accum)
1892_Avrlibc_Def_Pgm_Far_2 (uhk, unsigned short accum)
1893_Avrlibc_Def_Pgm_Far_4 (k, accum)
1894_Avrlibc_Def_Pgm_Far_4 (uk, unsigned accum)
1895_Avrlibc_Def_Pgm_Far_8 (lk, long accum)
1896_Avrlibc_Def_Pgm_Far_8 (ulk, unsigned long accum)
1897_Avrlibc_Def_Pgm_Far_8 (llk, long long accum)
1898_Avrlibc_Def_Pgm_Far_8 (ullk, unsigned long long accum)
1899#endif /* Doxygen */
1900
1901/** \name EEPROM Read Functions */
1902
1903/** \ingroup avr_stdfix
1904 Read a <tt>short fract</tt> from EEPROM address \a __p.
1905 \since AVR-LibC v2.3 */
1906short fract eeprom_read_hr (const short fract *__p) __asm("eeprom_read_byte") __ATTR_PURE__;
1907
1908/** \ingroup avr_stdfix
1909 Read an <tt>unsigned short fract</tt> from EEPROM address \a __p.
1910 \since AVR-LibC v2.3 */
1911unsigned short fract eeprom_read_uhr (const unsigned short fract *__p) __asm("eeprom_read_byte") __ATTR_PURE__;
1912
1913/** \ingroup avr_stdfix
1914 Read a <tt>fract</tt> from EEPROM address \a __p.
1915 \since AVR-LibC v2.3 */
1916fract eeprom_read_r (const fract *__p) __asm("eeprom_read_word") __ATTR_PURE__;
1917
1918/** \ingroup avr_stdfix
1919 Read an <tt>unsigned fract</tt> from EEPROM address \a __p.
1920 \since AVR-LibC v2.3 */
1921unsigned fract eeprom_read_ur (const unsigned fract *__p) __asm("eeprom_read_word") __ATTR_PURE__;
1922
1923/** \ingroup avr_stdfix
1924 Read a <tt>long fract</tt> from EEPROM address \a __p.
1925 \since AVR-LibC v2.3 */
1926long fract eeprom_read_lr (const long fract *__p) __asm("eeprom_read_dword") __ATTR_PURE__;
1927
1928/** \ingroup avr_stdfix
1929 Read an <tt>unsigned long fract</tt> from EEPROM address \a __p.
1930 \since AVR-LibC v2.3 */
1931unsigned long fract eeprom_read_ulr (const unsigned long fract *__p) __asm("eeprom_read_dword") __ATTR_PURE__;
1932
1933/** \ingroup avr_stdfix
1934 Read a <tt>long long fract</tt> from EEPROM address \a __p.
1935 \since AVR-LibC v2.3 */
1936long long fract eeprom_read_llr (const long long fract *__p) __asm("eeprom_read_qword") __ATTR_PURE__;
1937
1938/** \ingroup avr_stdfix
1939 Read an <tt>unsigned long long fract</tt> from EEPROM address \a __p.
1940 \since AVR-LibC v2.3 */
1941unsigned long long fract eeprom_read_ullr (const unsigned long long fract *__p) __asm("eeprom_read_qword") __ATTR_PURE__;
1942
1943/** \ingroup avr_stdfix
1944 Read a <tt>short accum</tt> from EEPROM address \a __p.
1945 \since AVR-LibC v2.3 */
1946short accum eeprom_read_hk (const short accum *__p) __asm("eeprom_read_word") __ATTR_PURE__;
1947
1948/** \ingroup avr_stdfix
1949 Read an <tt>unsigned short accum</tt> from EEPROM address \a __p.
1950 \since AVR-LibC v2.3 */
1951unsigned short accum eeprom_read_uhk (const unsigned short accum *__p) __asm("eeprom_read_word") __ATTR_PURE__;
1952
1953/** \ingroup avr_stdfix
1954 Read an <tt>accum</tt> from EEPROM address \a __p.
1955 \since AVR-LibC v2.3 */
1956accum eeprom_read_k (const accum *__p) __asm("eeprom_read_dword") __ATTR_PURE__;
1957
1958/** \ingroup avr_stdfix
1959 Read an <tt>unsigned accum</tt> from EEPROM address \a __p.
1960 \since AVR-LibC v2.3 */
1961unsigned accum eeprom_read_uk (const unsigned accum *__p) __asm("eeprom_read_dword") __ATTR_PURE__;
1962
1963/** \ingroup avr_stdfix
1964 Read a <tt>long accum</tt> from EEPROM address \a __p.
1965 \since AVR-LibC v2.3 */
1966long accum eeprom_read_lk (const long accum *__p) __asm("eeprom_read_qword") __ATTR_PURE__;
1967
1968/** \ingroup avr_stdfix
1969 Read an <tt>unsigned long accum</tt> from EEPROM address \a __p.
1970 \since AVR-LibC v2.3 */
1971unsigned long accum eeprom_read_ulk (const unsigned long accum *__p) __asm("eeprom_read_qword") __ATTR_PURE__;
1972
1973/** \ingroup avr_stdfix
1974 Read a <tt>long long accum</tt> from EEPROM address \a __p.
1975 \since AVR-LibC v2.3 */
1976long long accum eeprom_read_llk (const long long accum *__p) __asm("eeprom_read_qword") __ATTR_PURE__;
1977
1978/** \ingroup avr_stdfix
1979 Read an <tt>unsigned long long accum</tt> from EEPROM address \a __p.
1980 \since AVR-LibC v2.3 */
1981unsigned long long accum eeprom_read_ullk (const unsigned long long accum *__p) __asm("eeprom_read_qword") __ATTR_PURE__;
1982
1983
1984/** \name EEPROM Write Functions */
1985
1986/** \ingroup avr_stdfix
1987 Write a <tt>short fract</tt> to EEPROM address \a __p.
1988 \since AVR-LibC v2.3 */
1989void eeprom_write_hr (short fract *__p, short fract __value) __asm("eeprom_write_byte");
1990
1991/** \ingroup avr_stdfix
1992 Write an <tt>unsigned short fract</tt> to EEPROM address \a __p.
1993 \since AVR-LibC v2.3 */
1994void eeprom_write_uhr (unsigned short fract *__p, unsigned short fract __value) __asm("eeprom_write_byte");
1995
1996/** \ingroup avr_stdfix
1997 Write a <tt>fract</tt> to EEPROM address \a __p.
1998 \since AVR-LibC v2.3 */
1999void eeprom_write_r (fract *__p, fract __value) __asm("eeprom_write_word");
2000
2001/** \ingroup avr_stdfix
2002 Write an <tt>unsigned fract</tt> to EEPROM address \a __p.
2003 \since AVR-LibC v2.3 */
2004void eeprom_write_ur (unsigned fract *__p, unsigned fract __value) __asm("eeprom_write_word");
2005
2006/** \ingroup avr_stdfix
2007 Write a <tt>long fract</tt> to EEPROM address \a __p.
2008 \since AVR-LibC v2.3 */
2009void eeprom_write_lr (long fract *__p, long fract __value) __asm("eeprom_write_dword");
2010
2011/** \ingroup avr_stdfix
2012 Write an <tt>unsigned long fract</tt> to EEPROM address \a __p.
2013 \since AVR-LibC v2.3 */
2014void eeprom_write_ulr (unsigned long fract *__p, unsigned long fract __value) __asm("eeprom_write_dword");
2015
2016/** \ingroup avr_stdfix
2017 Write a <tt>long long fract</tt> to EEPROM address \a __p.
2018 \since AVR-LibC v2.3 */
2019void eeprom_write_llr (long long fract *__p, long long fract __value) __asm("eeprom_write_qword");
2020
2021/** \ingroup avr_stdfix
2022 Write an <tt>unsigned long long fract</tt> to EEPROM address \a __p.
2023 \since AVR-LibC v2.3 */
2024void eeprom_write_ullr (unsigned long long fract *__p, unsigned long long fract __value) __asm("eeprom_write_qword");
2025
2026/** \ingroup avr_stdfix
2027 Write a <tt>short accum</tt> to EEPROM address \a __p.
2028 \since AVR-LibC v2.3 */
2029void eeprom_write_hk (short accum *__p, short accum __value) __asm("eeprom_write_word");
2030
2031/** \ingroup avr_stdfix
2032 Write an <tt>unsigned short accum</tt> to EEPROM address \a __p.
2033 \since AVR-LibC v2.3 */
2034void eeprom_write_uhk (unsigned short accum *__p, unsigned short accum __value) __asm("eeprom_write_word");
2035
2036/** \ingroup avr_stdfix
2037 Write an <tt>accum</tt> to EEPROM address \a __p.
2038 \since AVR-LibC v2.3 */
2039void eeprom_write_k (accum *__p, accum __value) __asm("eeprom_write_dword");
2040
2041/** \ingroup avr_stdfix
2042 Write an <tt>unsigned accum</tt> to EEPROM address \a __p.
2043 \since AVR-LibC v2.3 */
2044void eeprom_write_uk (unsigned accum *__p, unsigned accum __value) __asm("eeprom_write_dword");
2045
2046/** \ingroup avr_stdfix
2047 Write a <tt>long accum</tt> to EEPROM address \a __p.
2048 \since AVR-LibC v2.3 */
2049void eeprom_write_lk (long accum *__p, long accum __value) __asm("eeprom_write_qword");
2050
2051/** \ingroup avr_stdfix
2052 Write an <tt>unsigned long accum</tt> to EEPROM address \a __p.
2053 \since AVR-LibC v2.3 */
2054void eeprom_write_ulk (unsigned long accum *__p, unsigned long accum __value) __asm("eeprom_write_qword");
2055
2056/** \ingroup avr_stdfix
2057 Write a <tt>long long accum</tt> to EEPROM address \a __p.
2058 \since AVR-LibC v2.3 */
2059void eeprom_write_llk (long long accum *__p, long long accum __value) __asm("eeprom_write_qword");
2060
2061/** \ingroup avr_stdfix
2062 Write an <tt>unsigned long long accum</tt> to EEPROM address \a __p.
2063 \since AVR-LibC v2.3 */
2064void eeprom_write_ullk (unsigned long long accum *__p, unsigned long long accum __value) __asm("eeprom_write_qword");
2065
2066
2067/** \name EEPROM Update Functions */
2068
2069/** \ingroup avr_stdfix
2070 Update a <tt>short fract</tt> at EEPROM address \a __p.
2071 \since AVR-LibC v2.3 */
2072void eeprom_update_hr (short fract *__p, short fract __value) __asm("eeprom_update_byte");
2073
2074/** \ingroup avr_stdfix
2075 Update an <tt>unsigned short fract</tt> at EEPROM address \a __p.
2076 \since AVR-LibC v2.3 */
2077void eeprom_update_uhr (unsigned short fract *__p, unsigned short fract __value) __asm("eeprom_update_byte");
2078
2079/** \ingroup avr_stdfix
2080 Update a <tt>fract</tt> at EEPROM address \a __p.
2081 \since AVR-LibC v2.3 */
2082void eeprom_update_r (fract *__p, fract __value) __asm("eeprom_update_word");
2083
2084/** \ingroup avr_stdfix
2085 Update an <tt>unsigned fract</tt> at EEPROM address \a __p.
2086 \since AVR-LibC v2.3 */
2087void eeprom_update_ur (unsigned fract *__p, unsigned fract __value) __asm("eeprom_update_word");
2088
2089/** \ingroup avr_stdfix
2090 Update a <tt>long fract</tt> at EEPROM address \a __p.
2091 \since AVR-LibC v2.3 */
2092void eeprom_update_lr (long fract *__p, long fract __value) __asm("eeprom_update_dword");
2093
2094/** \ingroup avr_stdfix
2095 Update an <tt>unsigned long fract</tt> at EEPROM address \a __p.
2096 \since AVR-LibC v2.3 */
2097void eeprom_update_ulr (unsigned long fract *__p, unsigned long fract __value) __asm("eeprom_update_dword");
2098
2099/** \ingroup avr_stdfix
2100 Update a <tt>long long fract</tt> at EEPROM address \a __p.
2101 \since AVR-LibC v2.3 */
2102void eeprom_update_llr (long long fract *__p, long long fract __value) __asm("eeprom_update_qword");
2103
2104/** \ingroup avr_stdfix
2105 Update an <tt>unsigned long long fract</tt> at EEPROM address \a __p.
2106 \since AVR-LibC v2.3 */
2107void eeprom_update_ullr (unsigned long long fract *__p, unsigned long long fract __value) __asm("eeprom_update_qword");
2108
2109/** \ingroup avr_stdfix
2110 Update a <tt>short accum</tt> at EEPROM address \a __p.
2111 \since AVR-LibC v2.3 */
2112void eeprom_update_hk (short accum *__p, short accum __value) __asm("eeprom_update_word");
2113
2114/** \ingroup avr_stdfix
2115 Update an <tt>unsigned short accum</tt> at EEPROM address \a __p.
2116 \since AVR-LibC v2.3 */
2117void eeprom_update_uhk (unsigned short accum *__p, unsigned short accum __value) __asm("eeprom_update_word");
2118
2119/** \ingroup avr_stdfix
2120 Update an <tt>accum</tt> at EEPROM address \a __p.
2121 \since AVR-LibC v2.3 */
2122void eeprom_update_k (accum *__p, accum __value) __asm("eeprom_update_dword");
2123
2124/** \ingroup avr_stdfix
2125 Update an <tt>unsigned accum</tt> at EEPROM address \a __p.
2126 \since AVR-LibC v2.3 */
2127void eeprom_update_uk (unsigned accum *__p, unsigned accum __value) __asm("eeprom_update_dword");
2128
2129/** \ingroup avr_stdfix
2130 Update a <tt>long accum</tt> at EEPROM address \a __p.
2131 \since AVR-LibC v2.3 */
2132void eeprom_update_lk (long accum *__p, long accum __value) __asm("eeprom_update_qword");
2133
2134/** \ingroup avr_stdfix
2135 Update an <tt>unsigned long accum</tt> at EEPROM address \a __p.
2136 \since AVR-LibC v2.3 */
2137void eeprom_update_ulk (unsigned long accum *__p, unsigned long accum __value) __asm("eeprom_update_qword");
2138
2139/** \ingroup avr_stdfix
2140 Update a <tt>long long accum</tt> at EEPROM address \a __p.
2141 \since AVR-LibC v2.3 */
2142void eeprom_update_llk (long long accum *__p, long long accum __value) __asm("eeprom_update_qword");
2143
2144/** \ingroup avr_stdfix
2145 Update an <tt>unsigned long long accum</tt> at EEPROM address \a __p.
2146 \since AVR-LibC v2.3 */
2147void eeprom_update_ullk (unsigned long long accum *__p, unsigned long long accum __value) __asm("eeprom_update_qword");
2148
2149#ifdef __cplusplus
2150}
2151#endif
2152
2153#endif /* _STDFIX_AVRLIBC_H */
void eeprom_write_dword(uint32_t *__p, uint32_t __value)
void eeprom_update_word(uint16_t *__p, uint16_t __value)
void eeprom_write_word(uint16_t *__p, uint16_t __value)
uint8_t eeprom_read_byte(const uint8_t *__p)
uint16_t eeprom_read_word(const uint16_t *__p)
void eeprom_update_byte(uint8_t *__p, uint8_t __value)
void eeprom_write_byte(uint8_t *__p, uint8_t __value)
void eeprom_update_qword(uint64_t *__p, uint64_t __value)
void eeprom_update_dword(uint32_t *__p, uint32_t __value)
void eeprom_write_qword(uint64_t *__p, uint64_t __value)
uint64_t eeprom_read_qword(const uint64_t *__p)
uint32_t eeprom_read_dword(const uint32_t *__p)
uint32_t uint_farptr_t
Definition: inttypes.h:83
void eeprom_write_ullr(unsigned long long fract *__p, unsigned long long fract __value)
accum roundk(accum val, int bit)
unsigned long long fract ullrbits(unsigned long long val)
long long fract absllr(long long fract val)
void eeprom_write_uhk(unsigned short accum *__p, unsigned short accum __value)
long accum lkbits(long long val)
long accum abslk(long accum val)
static long fract pgm_read_lr(const long fract *addr)
long fract roundlr(long fract val, int bit)
static short accum pgm_read_hk_far(uint_farptr_t addr)
long accum roundlk(long accum val, int bit)
unsigned long fract roundulr(unsigned long fract val, int bit)
long long accum roundllk(long long accum val, int bit)
int countlsulk(unsigned long accum val)
long accum eeprom_read_lk(const long accum *__p)
unsigned long long accum eeprom_read_ullk(const unsigned long long accum *__p)
void eeprom_update_ullk(unsigned long long accum *__p, unsigned long long accum __value)
void eeprom_update_hr(short fract *__p, short fract __value)
void eeprom_write_r(fract *__p, fract __value)
static unsigned short accum pgm_read_uhk(const unsigned short accum *addr)
unsigned long long bitsullr(unsigned long long fract val)
char * uktoa(unsigned accum x, char *buf, unsigned char mode)
char * rtoa(fract x, char *buf, unsigned char mode)
unsigned short fract uhrbits(unsigned char val)
int bitshk(short accum val)
int countlshk(short accum val)
static unsigned short fract pgm_read_uhr(const unsigned short fract *addr)
accum cospi2k(accum deg)
static unsigned short fract pgm_read_uhr_far(uint_farptr_t addr)
unsigned long fract sqrtulr(unsigned long fract radic)
unsigned short fract log21puhr(unsigned short fract x)
unsigned long bitsuk(unsigned accum val)
unsigned short fract eeprom_read_uhr(const unsigned short fract *__p)
void eeprom_write_lr(long fract *__p, long fract __value)
void eeprom_update_uhr(unsigned short fract *__p, unsigned short fract __value)
unsigned int bitsur(unsigned fract val)
long bitsk(accum val)
unsigned short accum rounduhk(unsigned short accum val, int bit)
unsigned long long bitsullk(unsigned long long accum val)
void eeprom_write_ulr(unsigned long fract *__p, unsigned long fract __value)
void eeprom_write_hr(short fract *__p, short fract __value)
short fract abshr(short fract val)
static short fract pgm_read_hr(const short fract *addr)
int countlshr(short fract val)
static unsigned long fract pgm_read_ulr(const unsigned long fract *addr)
int countlsuhr(unsigned short fract val)
fract roundr(fract val, int bit)
void eeprom_write_k(accum *__p, accum __value)
long long fract eeprom_read_llr(const long long fract *__p)
long long bitsllk(long long accum val)
long long accum eeprom_read_llk(const long long accum *__p)
static accum pgm_read_k_far(uint_farptr_t addr)
void eeprom_update_llk(long long accum *__p, long long accum __value)
unsigned fract sqrtur(unsigned fract radic)
void eeprom_write_ur(unsigned fract *__p, unsigned fract __value)
void eeprom_update_r(fract *__p, fract __value)
short accum abshk(short accum val)
char * urtoa(unsigned fract x, char *buf, unsigned char mode)
static long long accum pgm_read_llk(const long long accum *addr)
static unsigned long long accum pgm_read_ullk(const unsigned long long accum *addr)
void eeprom_update_k(accum *__p, accum __value)
unsigned long accum ulkbits(unsigned long long val)
fract eeprom_read_r(const fract *__p)
accum atank(accum x)
short accum hkbits(int val)
int countlslr(long fract val)
unsigned fract urdivi(unsigned int num, unsigned int denom)
int countlsllr(long long fract val)
void eeprom_update_uhk(unsigned short accum *__p, unsigned short accum __value)
void eeprom_write_llk(long long accum *__p, long long accum __value)
void eeprom_update_lk(long accum *__p, long accum __value)
long fract lrbits(long val)
short fract sqrthr(short fract radic)
int countlsk(accum val)
unsigned long long accum ullkbits(unsigned long long val)
long fract lrdivi(long int num, long int denom)
unsigned short accum uhkbits(unsigned int val)
long long fract roundllr(long long fract val, int bit)
void eeprom_write_ulk(unsigned long accum *__p, unsigned long accum __value)
long bitslr(long fract val)
accum eeprom_read_k(const accum *__p)
void eeprom_update_uk(unsigned accum *__p, unsigned accum __value)
unsigned accum sqrtuk(unsigned accum radic)
unsigned short fract rounduhr(unsigned short fract val, int bit)
short accum log2uhk(unsigned short accum x)
accum exp2k(accum x)
int countlsuk(unsigned accum val)
fract sinuhk_deg(unsigned short accum deg)
static short fract pgm_read_hr_far(uint_farptr_t addr)
unsigned long long fract roundullr(unsigned long long fract val, int bit)
unsigned long bitsulr(unsigned long fract val)
long fract sqrtlr(long fract radic)
char * ktoa(accum x, char *buf, unsigned char mode)
accum sinpi2k(accum deg)
type roundfx(type val, int bit)
static unsigned fract pgm_read_ur(const unsigned fract *addr)
void eeprom_update_hk(short accum *__p, short accum __value)
static accum pgm_read_k(const accum *addr)
void eeprom_write_llr(long long fract *__p, long long fract __value)
static long fract pgm_read_lr_far(uint_farptr_t addr)
short accum eeprom_read_hk(const short accum *__p)
long long accum llkbits(long long val)
static unsigned long long accum pgm_read_ullk_far(uint_farptr_t addr)
char * hrtoa(short fract x, char *buf, unsigned char mode)
int countlslk(long accum val)
int countlsulr(unsigned long fract val)
int countlsur(unsigned fract val)
unsigned accum acosuk(unsigned accum x)
fract sqrtr(fract radic)
unsigned short accum eeprom_read_uhk(const unsigned short accum *__p)
accum absk(accum val)
unsigned accum ukbits(unsigned long val)
signed char bitshr(short fract val)
void eeprom_update_lr(long fract *__p, long fract __value)
unsigned accum rounduk(unsigned accum val, int bit)
short fract hrbits(signed char val)
fract absr(fract val)
fract rbits(int val)
char * uhrtoa(unsigned short fract x, char *buf, unsigned char mode)
short fract roundhr(short fract val, int bit)
unsigned long long bitsulk(unsigned long accum val)
static unsigned long accum pgm_read_ulk(const unsigned long accum *addr)
long fract eeprom_read_lr(const long fract *__p)
int countlsullk(unsigned long long accum val)
unsigned long long fract eeprom_read_ullr(const unsigned long long fract *__p)
static fract pgm_read_r(const fract *addr)
static unsigned long long fract pgm_read_ullr(const unsigned long long fract *addr)
long long bitslk(long accum val)
unsigned short fract sqrtuhr(unsigned short fract radic)
static long long accum pgm_read_llk_far(uint_farptr_t addr)
long long accum absllk(long long accum val)
unsigned char bitsuhr(unsigned short fract val)
short accum sqrthk(short accum radic)
char * uhktoa(unsigned short accum x, char *buf, unsigned char mode)
void eeprom_write_lk(long accum *__p, long accum __value)
long fract abslr(long fract val)
void eeprom_write_uhr(unsigned short fract *__p, unsigned short fract __value)
void eeprom_update_ur(unsigned fract *__p, unsigned fract __value)
static unsigned short accum pgm_read_uhk_far(uint_farptr_t addr)
char * hktoa(short accum x, char *buf, unsigned char mode)
void eeprom_write_uk(unsigned accum *__p, unsigned accum __value)
static long accum pgm_read_lk(const long accum *addr)
accum log2uk(unsigned accum x)
unsigned long accum roundulk(unsigned long accum val, int bit)
unsigned fract eeprom_read_ur(const unsigned fract *__p)
static short accum pgm_read_hk(const short accum *addr)
int countlsllk(long long accum val)
unsigned int bitsuhk(unsigned short accum val)
int countlsullr(unsigned long long fract val)
void eeprom_write_hk(short accum *__p, short accum __value)
static unsigned long accum pgm_read_ulk_far(uint_farptr_t addr)
long long fract llrbits(long long val)
accum sqrtk(accum radic)
type absfx(type val)
static unsigned long long fract pgm_read_ullr_far(uint_farptr_t addr)
static unsigned fract pgm_read_ur_far(uint_farptr_t addr)
int countlsuhk(unsigned short accum val)
void eeprom_write_ullk(unsigned long long accum *__p, unsigned long long accum __value)
static unsigned accum pgm_read_uk(const unsigned accum *addr)
unsigned fract atanur(unsigned fract x)
static long long fract pgm_read_llr(const long long fract *addr)
unsigned accum exp2uk(unsigned accum x)
fract cosuhk_deg(unsigned short accum deg)
static unsigned accum pgm_read_uk_far(uint_farptr_t addr)
fract rdivi(int num, int denom)
void eeprom_update_ullr(unsigned long long fract *__p, unsigned long long fract __value)
void eeprom_update_ulk(unsigned long accum *__p, unsigned long accum __value)
int countlsr(fract val)
static long accum pgm_read_lk_far(uint_farptr_t addr)
unsigned long fract ulrbits(unsigned long val)
static unsigned long fract pgm_read_ulr_far(uint_farptr_t addr)
static fract pgm_read_r_far(uint_farptr_t addr)
unsigned fract exp2m1ur(unsigned fract x)
accum kbits(long val)
unsigned short accum sqrtuhk(unsigned short accum radic)
unsigned accum atanuk(unsigned accum x)
static long long fract pgm_read_llr_far(uint_farptr_t addr)
unsigned long long accum roundullk(unsigned long long accum val, int bit)
unsigned fract sinpi2ur(unsigned fract x)
unsigned long fract eeprom_read_ulr(const unsigned long fract *__p)
accum acosk(accum x)
accum asink(accum x)
void eeprom_update_llr(long long fract *__p, long long fract __value)
long long bitsllr(long long fract val)
int bitsr(fract val)
unsigned long fract ulrdivi(unsigned long int num, unsigned long int denom)
unsigned fract log21pur(unsigned fract x)
unsigned fract roundur(unsigned fract val, int bit)
unsigned accum asinuk(unsigned accum x)
int countlsfx(type val)
short fract eeprom_read_hr(const short fract *__p)
unsigned long accum eeprom_read_ulk(const unsigned long accum *__p)
unsigned accum eeprom_read_uk(const unsigned accum *__p)
unsigned fract urbits(unsigned int val)
void eeprom_update_ulr(unsigned long fract *__p, unsigned long fract __value)
short accum roundhk(short accum val, int bit)