DSP2812浮点运算库.doc_第1页
DSP2812浮点运算库.doc_第2页
DSP2812浮点运算库.doc_第3页
DSP2812浮点运算库.doc_第4页
DSP2812浮点运算库.doc_第5页
免费预览已结束,剩余80页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

/#/ FILE:IQmathLib.h/ TITLE:IQ Math library functions definitions./#/ Ver | dd-mmm-yyyy | Who | Description of changes/ =|=|=|=/ 1.3 | 19 Nov 2001 | A. T. | Original Release./ -|-|-|-/ 1.4 | 17 May 2002 | A. T. | Added new functions and support for/ | | | intrinsics IQmpy, IQxmpy, IQsat./ -|-|-|-/ 1.4a| 12 Jun 2002 | A. T. | Fixed problem with _IQ() operation on/ | | | variables./ -|-|-|-/ 1.4b| 18 Jun 2002 | A. T. | Fixed bug with _IQtoIQN() and _IQNtoIQ()/ | | | operations./ -|-|-|-/ 1.4d| 30 Mar 2003 | DA/SD | 1. Added macro parameters in parentheses / | | | in number of places where it matters/ | | | 2. Added macro definition to include header / | | | file multiple times in the program. / -|-|-|-/#/ / User needs to configure MATH_TYPE and GLOBAL_Q values:/-/ Select math type, IQ_MATH or FLOAT_MATH:/#ifndef _IQMATHLIB_H_INCLUDED_#define _IQMATHLIB_H_INCLUDED_#define FLOAT_MATH 1#define IQ_MATH 0#ifndef MATH_TYPE#define MATH_TYPE IQ_MATH#endif/-/ Select global Q value and scaling. The Q value is limited to the / following range for all functions:/ 30 = GLOBAL_Q = 1/#ifndef GLOBAL_Q#define GLOBAL_Q 24#endif/-/ Various Usefull Constant Definitions:/#define QG GLOBAL_Q#define Q30 30#define Q29 29#define Q28 28#define Q27 27#define Q26 26#define Q25 25#define Q24 24#define Q23 23#define Q22 22#define Q21 21#define Q20 20#define Q19 19#define Q18 18#define Q17 17#define Q16 16#define Q15 15#define Q14 14#define Q13 13#define Q12 12#define Q11 11#define Q10 10#define Q9 9#define Q8 8#define Q7 7#define Q6 6#define Q5 5#define Q4 4#define Q3 3#define Q2 2#define Q1 1#define MAX_IQ_POS 2147483647 #define MAX_IQ_NEG -2147483648#define MIN_IQ_POS 1#define MIN_IQ_NEG -1/#if MATH_TYPE = IQ_MATH/#/ If IQ_MATH is used, the following IQmath library function definitions/ are used:/=typedef long _iq;typedef long _iq30;typedef long _iq29;typedef long _iq28;typedef long _iq27;typedef long _iq26;typedef long _iq25;typedef long _iq24;typedef long _iq23;typedef long _iq22;typedef long _iq21;typedef long _iq20;typedef long _iq19;typedef long _iq18;typedef long _iq17;typedef long _iq16;typedef long _iq15;typedef long _iq14;typedef long _iq13;typedef long _iq12;typedef long _iq11;typedef long _iq10;typedef long _iq9;typedef long _iq8;typedef long _iq7;typedef long _iq6;typedef long _iq5;typedef long _iq4;typedef long _iq3;typedef long _iq2;typedef long _iq1;/-#define _IQ30(A) (long) (A) * 1073741824.0L)#define _IQ29(A) (long) (A) * 536870912.0L)#define _IQ28(A) (long) (A) * 268435456.0L)#define _IQ27(A) (long) (A) * 134217728.0L)#define _IQ26(A) (long) (A) * 67108864.0L)#define _IQ25(A) (long) (A) * 33554432.0L)#define _IQ24(A) (long) (A) * 16777216.0L)#define _IQ23(A) (long) (A) * 8388608.0L)#define _IQ22(A) (long) (A) * 4194304.0L)#define _IQ21(A) (long) (A) * 2097152.0L)#define _IQ20(A) (long) (A) * 1048576.0L)#define _IQ19(A) (long) (A) * 524288.0L)#define _IQ18(A) (long) (A) * 262144.0L)#define _IQ17(A) (long) (A) * 131072.0L)#define _IQ16(A) (long) (A) * 65536.0L)#define _IQ15(A) (long) (A) * 32768.0L)#define _IQ14(A) (long) (A) * 16384.0L)#define _IQ13(A) (long) (A) * 8192.0L)#define _IQ12(A) (long) (A) * 4096.0L)#define _IQ11(A) (long) (A) * 2048.0L)#define _IQ10(A) (long) (A) * 1024.0L)#define _IQ9(A) (long) (A) * 512.0L)#define _IQ8(A) (long) (A) * 256.0L)#define _IQ7(A) (long) (A) * 128.0L)#define _IQ6(A) (long) (A) * 64.0L)#define _IQ5(A) (long) (A) * 32.0L)#define _IQ4(A) (long) (A) * 16.0L)#define _IQ3(A) (long) (A) * 8.0L)#define _IQ2(A) (long) (A) * 4.0L)#define _IQ1(A) (long) (A) * 2.0L)#if GLOBAL_Q = 30#define _IQ(A) _IQ30(A)#endif#if GLOBAL_Q = 29#define _IQ(A) _IQ29(A)#endif#if GLOBAL_Q = 28#define _IQ(A) _IQ28(A)#endif#if GLOBAL_Q = 27#define _IQ(A) _IQ27(A)#endif#if GLOBAL_Q = 26#define _IQ(A) _IQ26(A)#endif#if GLOBAL_Q = 25#define _IQ(A) _IQ25(A)#endif#if GLOBAL_Q = 24#define _IQ(A) _IQ24(A)#endif#if GLOBAL_Q = 23#define _IQ(A) _IQ23(A)#endif#if GLOBAL_Q = 22#define _IQ(A) _IQ22(A)#endif#if GLOBAL_Q = 21#define _IQ(A) _IQ21(A)#endif#if GLOBAL_Q = 20#define _IQ(A) _IQ20(A)#endif#if GLOBAL_Q = 19#define _IQ(A) _IQ19(A)#endif#if GLOBAL_Q = 18#define _IQ(A) _IQ18(A)#endif#if GLOBAL_Q = 17#define _IQ(A) _IQ17(A)#endif#if GLOBAL_Q = 16#define _IQ(A) _IQ16(A)#endif#if GLOBAL_Q = 15#define _IQ(A) _IQ15(A)#endif#if GLOBAL_Q = 14#define _IQ(A) _IQ14(A)#endif#if GLOBAL_Q = 13#define _IQ(A) _IQ13(A)#endif#if GLOBAL_Q = 12#define _IQ(A) _IQ12(A)#endif#if GLOBAL_Q = 11#define _IQ(A) _IQ11(A)#endif#if GLOBAL_Q = 10#define _IQ(A) _IQ10(A)#endif#if GLOBAL_Q = 9#define _IQ(A) _IQ9(A)#endif#if GLOBAL_Q = 8#define _IQ(A) _IQ8(A)#endif#if GLOBAL_Q = 7#define _IQ(A) _IQ7(A)#endif#if GLOBAL_Q = 6#define _IQ(A) _IQ6(A)#endif#if GLOBAL_Q = 5#define _IQ(A) _IQ5(A)#endif#if GLOBAL_Q = 4#define _IQ(A) _IQ4(A)#endif#if GLOBAL_Q = 3#define _IQ(A) _IQ3(A)#endif#if GLOBAL_Q = 2#define _IQ(A) _IQ2(A)#endif#if GLOBAL_Q = 1#define _IQ(A) _IQ1(A)#endif/-extern float _IQ30toF(long A);extern float _IQ29toF(long A);extern float _IQ28toF(long A);extern float _IQ27toF(long A);extern float _IQ26toF(long A);extern float _IQ25toF(long A);extern float _IQ24toF(long A);extern float _IQ23toF(long A);extern float _IQ22toF(long A);extern float _IQ21toF(long A);extern float _IQ20toF(long A);extern float _IQ19toF(long A);extern float _IQ18toF(long A);extern float _IQ17toF(long A);extern float _IQ16toF(long A);extern float _IQ15toF(long A);extern float _IQ14toF(long A);extern float _IQ13toF(long A);extern float _IQ12toF(long A);extern float _IQ11toF(long A);extern float _IQ10toF(long A);extern float _IQ9toF(long A);extern float _IQ8toF(long A);extern float _IQ7toF(long A);extern float _IQ6toF(long A);extern float _IQ5toF(long A);extern float _IQ4toF(long A);extern float _IQ3toF(long A);extern float _IQ2toF(long A);extern float _IQ1toF(long A);#if GLOBAL_Q = 30#define _IQtoF(A) _IQ30toF(A)#endif#if GLOBAL_Q = 29#define _IQtoF(A) _IQ29toF(A)#endif#if GLOBAL_Q = 28#define _IQtoF(A) _IQ28toF(A)#endif#if GLOBAL_Q = 27#define _IQtoF(A) _IQ27toF(A)#endif#if GLOBAL_Q = 26#define _IQtoF(A) _IQ26toF(A)#endif#if GLOBAL_Q = 25#define _IQtoF(A) _IQ25toF(A)#endif#if GLOBAL_Q = 24#define _IQtoF(A) _IQ24toF(A)#endif#if GLOBAL_Q = 23#define _IQtoF(A) _IQ23toF(A)#endif#if GLOBAL_Q = 22#define _IQtoF(A) _IQ22toF(A)#endif#if GLOBAL_Q = 21#define _IQtoF(A) _IQ21toF(A)#endif#if GLOBAL_Q = 20#define _IQtoF(A) _IQ20toF(A)#endif#if GLOBAL_Q = 19#define _IQtoF(A) _IQ19toF(A)#endif#if GLOBAL_Q = 18#define _IQtoF(A) _IQ18toF(A)#endif#if GLOBAL_Q = 17#define _IQtoF(A) _IQ17toF(A)#endif#if GLOBAL_Q = 16#define _IQtoF(A) _IQ16toF(A)#endif#if GLOBAL_Q = 15#define _IQtoF(A) _IQ15toF(A)#endif#if GLOBAL_Q = 14#define _IQtoF(A) _IQ14toF(A)#endif#if GLOBAL_Q = 13#define _IQtoF(A) _IQ13toF(A)#endif#if GLOBAL_Q = 12#define _IQtoF(A) _IQ12toF(A)#endif#if GLOBAL_Q = 11#define _IQtoF(A) _IQ11toF(A)#endif#if GLOBAL_Q = 10#define _IQtoF(A) _IQ10toF(A)#endif#if GLOBAL_Q = 9#define _IQtoF(A) _IQ9toF(A)#endif#if GLOBAL_Q = 8#define _IQtoF(A) _IQ8toF(A)#endif#if GLOBAL_Q = 7#define _IQtoF(A) _IQ7toF(A)#endif#if GLOBAL_Q = 6#define _IQtoF(A) _IQ6toF(A)#endif#if GLOBAL_Q = 5#define _IQtoF(A) _IQ5toF(A)#endif#if GLOBAL_Q = 4#define _IQtoF(A) _IQ4toF(A)#endif#if GLOBAL_Q = 3#define _IQtoF(A) _IQ3toF(A)#endif#if GLOBAL_Q = 2#define _IQtoF(A) _IQ2toF(A)#endif#if GLOBAL_Q = 1#define _IQtoF(A) _IQ1toF(A)#endif/-#define _IQsat(A, Pos, Neg) _IQsat(A, Pos, Neg)/-#define _IQtoIQ30(A) (long) (A) (30 - GLOBAL_Q)#define _IQtoIQ29(A) (GLOBAL_Q = 29) ? (long) (A) (GLOBAL_Q - 29):(long) (A) = 29) ? (long) (A) (29 - GLOBAL_Q)#define _IQtoIQ28(A) (GLOBAL_Q = 28) ? (long) (A) (GLOBAL_Q - 28):(long) (A) = 28) ? (long) (A) (28 - GLOBAL_Q)#define _IQtoIQ27(A) (GLOBAL_Q = 27) ? (long) (A) (GLOBAL_Q - 27):(long) (A) = 27) ? (long) (A) (27 - GLOBAL_Q)#define _IQtoIQ26(A) (GLOBAL_Q = 26) ? (long) (A) (GLOBAL_Q - 26):(long) (A) = 26) ? (long) (A) (26 - GLOBAL_Q)#define _IQtoIQ25(A) (GLOBAL_Q = 25) ? (long) (A) (GLOBAL_Q - 25):(long) (A) = 25) ? (long) (A) (25 - GLOBAL_Q)#define _IQtoIQ24(A) (GLOBAL_Q = 24) ? (long) (A) (GLOBAL_Q - 24):(long) (A) = 24) ? (long) (A) (24 - GLOBAL_Q)#define _IQtoIQ23(A) (GLOBAL_Q = 23) ? (long) (A) (GLOBAL_Q - 23):(long) (A) = 23) ? (long) (A) (23 - GLOBAL_Q)#define _IQtoIQ22(A) (GLOBAL_Q = 22) ? (long) (A) (GLOBAL_Q - 22):(long) (A) = 22) ? (long) (A) (22 - GLOBAL_Q)#define _IQtoIQ21(A) (GLOBAL_Q = 21) ? (long) (A) (GLOBAL_Q - 21):(long) (A) = 21) ? (long) (A) (21 - GLOBAL_Q)#define _IQtoIQ20(A) (GLOBAL_Q = 20) ? (long) (A) (GLOBAL_Q - 20):(long) (A) = 20) ? (long) (A) (20 - GLOBAL_Q)#define _IQtoIQ19(A) (GLOBAL_Q = 19) ? (long) (A) (GLOBAL_Q - 19):(long) (A) = 19) ? (long) (A) (19 - GLOBAL_Q)#define _IQtoIQ18(A) (GLOBAL_Q = 18) ? (long) (A) (GLOBAL_Q - 18):(long) (A) = 18) ? (long) (A) (18 - GLOBAL_Q)#define _IQtoIQ17(A) (GLOBAL_Q = 17) ? (long) (A) (GLOBAL_Q - 17):(long) (A) = 17) ? (long) (A) (17 - GLOBAL_Q)#define _IQtoIQ16(A) (GLOBAL_Q = 16) ? (long) (A) (GLOBAL_Q - 16):(long) (A) = 16) ? (long) (A) (16 - GLOBAL_Q)#define _IQtoIQ15(A) (GLOBAL_Q = 15) ? (long) (A) (GLOBAL_Q - 15):(long) (A) = 15) ? (long) (A) (15 - GLOBAL_Q)#define _IQtoIQ14(A) (GLOBAL_Q = 14) ? (long) (A) (GLOBAL_Q - 14):(long) (A) = 14) ? (long) (A) (14 - GLOBAL_Q)#define _IQtoIQ13(A) (GLOBAL_Q = 13) ? (long) (A) (GLOBAL_Q - 13):(long) (A) = 13) ? (long) (A) (13 - GLOBAL_Q)#define _IQtoIQ12(A) (GLOBAL_Q = 12) ? (long) (A) (GLOBAL_Q - 12):(long) (A) = 12) ? (long) (A) (12 - GLOBAL_Q)#define _IQtoIQ11(A) (GLOBAL_Q = 11) ? (long) (A) (GLOBAL_Q - 11):(long) (A) = 11) ? (long) (A) (11 - GLOBAL_Q)#define _IQtoIQ10(A) (GLOBAL_Q = 10) ? (long) (A) (GLOBAL_Q - 10):(long) (A) = 10) ? (long) (A) (10 - GLOBAL_Q)#define _IQtoIQ9(A) (GLOBAL_Q = 9) ? (long) (A) (GLOBAL_Q - 9):(long) (A) = 9) ? (long) (A) (9 - GLOBAL_Q)#define _IQtoIQ8(A) (GLOBAL_Q = 8) ? (long) (A) (GLOBAL_Q - 8):(long) (A) = 8) ? (long) (A) (8 - GLOBAL_Q)#define _IQtoIQ7(A) (GLOBAL_Q = 7) ? (long) (A) (GLOBAL_Q - 7):(long) (A) = 7) ? (long) (A) (7 - GLOBAL_Q)#define _IQtoIQ6(A) (GLOBAL_Q = 6) ? (long) (A) (GLOBAL_Q - 6):(long) (A) = 6) ? (long) (A) (6 - GLOBAL_Q)#define _IQtoIQ5(A) (GLOBAL_Q = 5) ? (long) (A) (GLOBAL_Q - 5):(long) (A) = 5) ? (long) (A) (5 - GLOBAL_Q)#define _IQtoIQ4(A) (GLOBAL_Q = 4) ? (long) (A) (GLOBAL_Q - 4):(long) (A) = 4) ? (long) (A) (4 - GLOBAL_Q)#define _IQtoIQ3(A) (GLOBAL_Q = 3) ? (long) (A) (GLOBAL_Q - 3):(long) (A) = 3) ? (long) (A) (3 - GLOBAL_Q)#define _IQtoIQ2(A) (GLOBAL_Q = 2) ? (long) (A) (GLOBAL_Q - 2):(long) (A) = 2) ? (long) (A) (2 - GLOBAL_Q)#define _IQtoIQ1(A) (long) (A) (GLOBAL_Q - 1)#define _IQ1toIQ(A) (long) (A) = 15) ? (long) (A) (GLOBAL_Q - 15):(long) (A) = 15) ? (long) (A) (15 - GLOBAL_Q)#define _IQtoQ14(A) (GL

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论