📄 math_ext40.c
字号:
/* Notice: */
/* This contribution has been prepared by the contributor to assist */
/* 3GPP2 Technical Specifications Group C. This document is offered */
/* to 3GPP2 Technical Specifications Group C as a basis for */
/* discussion and should not be construed as a binding proposal on */
/* Lucent Technologies Inc. or any other company. Specifically, */
/* Lucent Technologies Inc. reserves the right to modify, amend, or */
/* withdraw the statements contained herein. */
/* */
/* Permission is granted to 3GPP2 Technical Specifications Group C */
/* participants to copy any portion of this document for legitimate */
/* purposes of 3GPP2 Technical Specifications Group C. Copying for */
/* monetary gain or other non-3GPP2 Technical Specifications Group C */
/* purposes is prohibited. */
/* */
/*-------------------------------------------------------------------*/
/* */
/* Grant of license Motorola Inc. grants a free, irrevocable license */
/* to 3GPP2 and its organizational partners to incorporate Motorola- */
/* supplied text or other copyrightable material contained in the */
/* contribution and any modifications thereof in the creation of */
/* 3GPP2 publications, to copyright and sell in organizational */
/* partners name any organizational partners standards publications */
/* even though it may include portions of the contribution; and at */
/* the organizational partners sole discretion to permit others */
/* to reproduce in whole or in part such contributions or the */
/* resulting organizational partners standards publication. Motorola */
/* is also willing to grant licenses under such Motorola copyrights */
/* to third parties on reasonable, non-discriminatory terms and */
/* conditions, as appropriate. */
/* */
/* Notice: */
/* This document has been prepared by Motorola Inc. to assist the */
/* 3GPP2 standards committee. This document is offered to the */
/* committee as a basis for discussion and should not be considered */
/* as a binding proposal on Motorola Inc. or any other company. */
/* Specifically, Motorola Inc. reserves the right to modify, amend, */
/* or withdraw the statement contained herein. Permission is granted */
/* to 3GPP2 and its organizational partners to copy any portion of */
/* this document for the legitimate purposes of the 3GPP2. Copying */
/* this document for monetary gain or other non-3GPP2 purpose is */
/* prohibited. Motorola Inc. may hold one or more patents of */
/* copyrights that cover information contained in this contribution, */
/* and agrees that a license under those rights will be made */
/* available on reasonable and non-discriminatory terms and */
/* conditions, subject to receiving a reciprocal license in return. */
/* Nothing contained herein shall be construed as conferring by */
/* implication, estoppel, or otherwise any license or right under */
/* any patent, whether or not the use of information herein */
/* necessarily employs an invention of any existing or later issued */
/* patent, or copyright. */
/* */
/* Notice */
/* Permission is granted to 3GPP2 participants to copy any portion of*/
/* this contribution for the legitimate purpose of the 3GPP2. */
/* Copying this contribution for monetary gain or other non-3GPP2 */
/* purpose is prohibited. */
/* */
/*===================================================================*/
/* LIBRARY: math_ext40.c */
/*-------------------------------------------------------------------*/
/* PURPOSE: Extended mathematical functions 40bits. */
/*===================================================================*/
#include "typedef_fx.h"
#include "basic_op40.h"
#include "math_ext32.h"
/*----------------------------------------------------------------------------*/
/*-------------------------------- FUNCTIONS ---------------------------------*/
/*----------------------------------------------------------------------------*/
/*****************************************************************************
*
* Function Name : L_msu40_16_32
*
* Purpose :
*
* Multiply var1 by L_var2 and shift the result left by 1. Add the 40
* bit result to acc40 with saturation, return a 40 bit result:
* L_msu(acc40,var1,var2) = L_sub40(acc40,(L_mult40(var1,var2)).
*
* Complexity weight : 1
*
* Inputs :
*
* acc40 40 bit long signed integer (Word40) whose value falls in the
* range : MIN_40 <= L_var3 <= MAX_40.
*
* var1 16 bit short signed integer (Word16) whose value falls in
* the range : MIN_16 <= var1 <= MAX_16.
*
* var2 32 bit long signed integer (Word32) whose value falls in
* therange : MIN_32 <= var1 <= MAX_32.
*
* Return Value :
*
* L_var_out
* 40 bit long signed integer (Word40) whose value falls in the
* range : MIN_40 <= L_var_out <= MAX_40.
*****************************************************************************/
Word40 L_msu40_16_32 (Word40 acc40, Word16 var1, Word32 L_var2)
{
Word32 reg32;
reg32 = L_mpy_ls(L_var2, var1);
acc40 = L_sub40 (acc40, reg32);
return (acc40);
}
/*---------------------------------------------------------------------------*/
/*****************************************************************************
*
* Function Name : L_mac40_16_32
*
* Purpose :
*
* Multiply var1 by L_var2 and shift the result left by 1. Add the 40
* bit result to acc40 with saturation, return a 40 bit result:
* L_mac(acc40,var1,var2) = L_add40(L_var3,(L_mult40(var1,var2)).
*
* Complexity weight : 1
*
* Inputs :
*
* acc40 40 bit long signed integer (Word40) whose value falls in the
* range : MIN_40 <= L_var3 <= MAX_40.
*
* var1 16 bit short signed integer (Word16) whose value falls in
* the range : MIN_16 <= var1 <= MAX_16.
*
* L_var2 32 bit long signed integer (Word32) whose value falls in
* therange : MIN_32 <= var1 <= MAX_32.
*
* Return Value :
*
* L_var_out
* 40 bit long signed integer (Word40) whose value falls in the
* range : MIN_40 <= L_var_out <= MAX_40.
******************************************************************************/
Word40 L_mac40_16_32 (Word40 acc40, Word16 var1, Word32 L_var2)
{
Word32 reg32;
reg32 = L_mpy_ls(L_var2, var1);
acc40 = L_add40 (acc40, reg32);
return (acc40);
}
/*---------------------------------------------------------------------------*/
/*============================================================================*/
/*----------------------------------- END ------------------------------------*/
/*============================================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -