?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 6

Line No. Rev Author Line
1 6 kaklik /*! \file fixedpt.h \brief Fixed-point math function library. */
2 //*****************************************************************************
3 //
4 // File Name : 'fixedpt.h'
5 // Title : Fixed-point math function library
6 // Author : Pascal Stang - Copyright (C) 2003
7 // Created : 2003.01.26
8 // Revised : 2003.02.04
9 // Version : 0.1
10 // Target MCU : Atmel AVR Series
11 // Editor Tabs : 4
12 //
13 // NOTE: This code is currently below version 1.0, and therefore is considered
14 // to be lacking in some functionality or documentation, or may not be fully
15 // tested. Nonetheless, you can expect most functions to work.
16 //
17 /// \ingroup general
18 /// \defgroup fixedpt Fixed-Point Math Function Library (fixedpt.c)
19 /// \code #include "fixedpt.h" \endcode
20 /// \par Overview
21 /// This library provides basic fixed-point math operations implemented in
22 /// C. Fixed-point math is a system by which integer variables can
23 /// represent fractional values with a fixed precision "behind" the decimal
24 /// point (like a fixed number of decimal places). Fixed-point math is
25 /// typically 10x faster to execute than floating-point math, and should
26 /// be used when a limited amount of fractional precision is sufficient
27 /// (such as 4ths, or 10ths, or 128ths, etc).
28 ///
29 /// \note This library is really meant more as a demonstration of fixed-pt
30 /// math. For best code-efficiency and speed, you are enouraged to take
31 /// the code you see in these functions and copy it into your own code.
32 //
33 // This code is distributed under the GNU Public License
34 // which can be found at http://www.gnu.org/licenses/gpl.txt
35 //
36 //*****************************************************************************
37  
38 #ifndef FIXEDPT_H
39 #define FIXEDPT_H
40  
41 #include "global.h"
42  
43 // constants/macros/typdefs
44  
45 // functions
46  
47 //! fixedptInit() initializes fixed-point math function library
48 // set the number of bits to use behind the point
49 void fixedptInit(u08 fixedPtBits);
50  
51 //! convert integer to fixed-point number
52 s32 fixedptConvertFromInt(s32 int_number);
53  
54 //! convert fixed-point number to integer
55 s32 fixedptConvertToInt(s32 fp_number);
56  
57 //! add a and b (a+b) with fixed-point math
58 s32 fixedptAdd(s32 a, s32 b);
59  
60 //! subtract a and b (a-b) with fixed-point math
61 s32 fixedptSubtract(s32 a, s32 b);
62  
63 //! multiply a and b (a*b) with fixed-point math
64 s32 fixedptMultiply(s32 a, s32 b);
65  
66 //! divide numer by denom (numer/denom) with fixed-point math
67 s32 fixedptDivide(s32 numer, s32 denom);
68  
69 #endif
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3