238 lines
10 KiB
C
238 lines
10 KiB
C
/*----------------------------------------------------------------------------------*/
|
|
/* Filename : SCA_sw12.h */
|
|
/* Author : Frederic Philippe */
|
|
/* : Marc Trabucato */
|
|
/* Target : PC */
|
|
/*----------------------------------------------------------------------------------*/
|
|
|
|
/* -----------------15/04/98 17:45-------------------
|
|
* Conversion : OK (avec version du 23.04.98 19:26 (19635))
|
|
* --------------------------------------------------*/
|
|
#ifndef _SCA_sw12_H_
|
|
#define _SCA_sw12_H_
|
|
|
|
/*----------------------------------------------------------------------------------*/
|
|
|
|
/* New */
|
|
/*-----------------*/
|
|
/* Fixed coma case */
|
|
/*-----------------*/
|
|
/* 1.3.12 */
|
|
|
|
/*---------------------------------*/
|
|
/* Specific Values for fixed point */
|
|
/*---------------------------------*/
|
|
#define SCA_td_sw12 MTH_tdxReal
|
|
|
|
/*#define SCA_sw12_C_sw12ComaDecal 0*/
|
|
/*#define SCA_sw12_C_sw12ComaCoef 1*/
|
|
|
|
/*#define SCA_sw12_C_dfMax 32768*/
|
|
/*#define SCA_sw12_C_dfMin (-SCA_sw12_C_dfMax)*/
|
|
|
|
/*#define SCA_sw12_C_sw12Max 32767*/
|
|
/*#define SCA_sw12_C_sw12Min -32767*/
|
|
/*#define SCA_sw12_C_sw12Error -32768*/
|
|
|
|
/*#define SCA_sw12_C_sw12NegMask (0x8000)*/
|
|
/*#define SCA_sw12_C_sw12PosMask (0x7FFF)*/
|
|
/*#define SCA_sw12_C_sw12DecMask (0x0000)*/
|
|
/*#define SCA_sw12_C_sw12EntMask (0xFFFF)*/
|
|
|
|
/*--------------------------------------------------------*/
|
|
/* ---------------- Constants ---------------------------*/
|
|
/*--------------------------------------------------------*/
|
|
#define SCA_sw12_C_ZERO MTH_C_ZERO
|
|
#define SCA_sw12_C_ONE MTH_C_ONE
|
|
|
|
|
|
/*--------------------------------------------------------*/
|
|
/* Conversion functions */
|
|
/*--------------------------------------------------------*/
|
|
__inline SCA_td_sw12 SCA_sw12_fn_sw12Double2Real( double _dfValue )
|
|
{
|
|
return MTH_M_xDoubleToReal( _dfValue );
|
|
}
|
|
/*--------------------------------------------------------*/
|
|
__inline double SCA_sw12_fn_Real2Double( SCA_td_sw12 _xValue )
|
|
{
|
|
return MTH_M_xRealToDouble( _xValue );
|
|
}
|
|
|
|
/*--------------------------------------------*/
|
|
/* Conversions : Macros definitions */
|
|
/*--------------------------------------------*/
|
|
#define SCA_sw12_M_sw12DoubleToReal(_dfValue) MTH_M_xDoubleToReal(_dfValue)
|
|
#define SCA_sw12_M_sw12FloatToReal(_fValue) MTH_M_xFloatToReal(_fValue)
|
|
#define SCA_sw12_M_sw12IntToReal(_iValue) MTH_M_xLongToReal(_iValue) /*???*/
|
|
|
|
#define SCA_sw12_M_RealToDouble(_xValue) MTH_M_xRealToDouble(_xValue)
|
|
#define SCA_sw12_M_RealToFloat(_xValue) MTH_M_xrealToFloat(_xValue)
|
|
#define SCA_sw12_M_RealToInt(_xValue) MTh_M_xRealToLong(_xValue) /*???*/
|
|
|
|
/*--------------------------------------------------------*/
|
|
/* Constantes */
|
|
/*--------------------------------------------------------*/
|
|
#define SCA_sw12_C_sw12Two MTH_C_2
|
|
|
|
/* ##CONSTANTE#--------------------------------------------------------------------------
|
|
Real Constantes declaration
|
|
---------------------------------------------------------------------------------------*/
|
|
|
|
#define SCA_sw12_C_InfinitPlus MTH_C_InfinitPlus
|
|
#define SCA_sw12_InfinitMinus MTH_C_InfinitMinus
|
|
#define SCA_sw12_EpsilonPlus MTH_C_EpsilonPlus
|
|
#define SCA_sw12_EpsilonMinus MTH_C_EpsilonMinus
|
|
|
|
#define SCA_sw12_Pi MTH_C_Pi
|
|
#define SCA_sw12_2Pi MTH_C_2Pi
|
|
#define SCA_sw12_PiBy2 MTH_C_PiBy2
|
|
#define SCA_sw12_PiBy4 MTH_C_PiBy4
|
|
#define SCA_sw12_PiBy8 MTH_C_PiBy8
|
|
#define SCA_sw12_PiBy180 MTH_C_PiBy180
|
|
#define SCA_sw12_180ByPi MTH_C_180ByPi
|
|
#define SCA_sw12_e MTH_C_e
|
|
|
|
#define SCA_sw12_MinusONE MTH_C_MinusONE
|
|
|
|
#define SCA_sw12_2 MTH_C_2
|
|
#define SCA_sw12_3 MTH_C_3
|
|
#define SCA_sw12_4 MTH_C_4
|
|
#define SCA_sw12_5 MTH_C_5
|
|
#define SCA_sw12_8 (double) 8.0
|
|
|
|
#define SCA_sw12_Minus2 MTH_C_Minus2
|
|
#define SCA_sw12_Minus3 MTH_C_Minus3
|
|
#define SCA_sw12_Minus4 MTH_C_Minus4
|
|
#define SCA_sw12_Minus5 MTH_C_Minus5
|
|
|
|
#define SCA_sw12_Inv2 MTH_C_Inv2
|
|
#define SCA_sw12_Inv3 MTH_C_Inv3
|
|
#define SCA_sw12_Inv4 MTH_C_Inv4
|
|
#define SCA_sw12_Inv5 MTH_C_Inv5
|
|
|
|
#define SCA_sw12_MinusInv2 MTH_C_MinusInv2
|
|
#define SCA_sw12_MinusInv3 MTH_C_MinusInv3
|
|
#define SCA_sw12_MinusInv4 MTH_C_MinusInv4
|
|
#define SCA_sw12_MinusInv5 MTH_C_MinusInv5
|
|
|
|
#define SCA_sw12_Sqrt2 MTH_C_Sqrt2
|
|
#define SCA_sw12_Sqrt3 MTH_C_Sqrt3
|
|
#define SCA_sw12_Sqrt4 MTH_C_Sqrt4
|
|
#define SCA_sw12_Sqrt5 MTH_C_Sqrt5
|
|
|
|
#define SCA_sw12_MinusSqrt2 MTH_C_MinusSqrt2
|
|
#define SCA_sw12_MinusSqrt3 MTH_C_MinusSqrt3
|
|
#define SCA_sw12_MinusSqrt4 MTH_C_MinusSqrt4
|
|
#define SCA_sw12_MinusSqrt5 MTH_C_MinusSqrt5
|
|
|
|
#define SCA_sw12_InvSqrt2 MTH_C_InvSqrt2
|
|
#define SCA_sw12_InvSqrt3 MTH_C_InvSqrt3
|
|
#define SCA_sw12_InvSqrt4 MTH_C_InvSqrt4
|
|
#define SCA_sw12_InvSqrt5 MTH_C_InvSqrt5
|
|
|
|
#define SCA_sw12_MinusInvSqrt2 MTH_C_MinusInvSqrt2
|
|
#define SCA_sw12_MinusInvSqrt3 MTH_C_MinusInvSqrt3
|
|
#define SCA_sw12_MinusInvSqrt4 MTH_C_MinusInvSqrt4
|
|
#define SCA_sw12_MinusInvSqrt5 MTH_C_MinusInvSqrt5
|
|
|
|
#define SCA_sw12_MAX_UNSIGNED_CHAR MTH_C_MAX_UNSIGNED_CHAR
|
|
|
|
/*--------------------------------------------------------*/
|
|
/* Operations */
|
|
/*--------------------------------------------------------*/
|
|
/* Comparaisons */
|
|
#define SCA_sw12_M_bIsNull(_xOp) MTH_M_bIsNull(_xOp)
|
|
#define SCA_sw12_M_bEqualZero(_sw12Op) MTH_M_bEqualZero(_sw12Op)
|
|
#define SCA_sw12_M_bIsNegative(_xOp) MTH_M_bLessZero((_xOp)
|
|
#define SCA_sw12_M_bIsPositive(_xOp) MTH_M_bGreaterZero(_xOp)
|
|
#define SCA_sw12_M_bGreater(_xOp1,_xOp2) MTH_M_bGreater(_xOp1,_xOp2)
|
|
#define SCA_sw12_M_bLess(_xOp1,_xOp2) MTH_M_bLess_xOp1,_xOp2)
|
|
#define SCA_sw12_M_bGreaterEqual(_xOp1,_xOp2) MTH_M_bGreaterEqual(_xOp1,_xOp2)
|
|
#define SCA_sw12_M_bLessEqual(_xOp1,_xOp2) MTH_M_bLessEqual(_xOp1,_xOp2)
|
|
#define SCA_sw12_M_bEqual(_xOp1,_xOp2) MTH_M_bEqual(_xOp1,_xOp2)
|
|
#define SCA_sw12_M_bDifferent(_xOp1,_xOp2) MTH_M_bDifferent(_xOp1,_xOp2)
|
|
#define SCA_sw12_M_sw12Max(A,B) MTH_M_xMax(A,B)
|
|
#define SCA_sw12_M_sw12Min(A,B) MTH_M_xMin(A,B)
|
|
|
|
/* Operations */
|
|
#define SCA_sw12_M_sw12Neg(_xOp) MTH_M_xNeg(_xOp)
|
|
#define SCA_sw12_M_sw12Add(_xOp1,_xOp2) MTH_M_xAdd(_xOp1,_xOp2)
|
|
#define SCA_sw12_M_sw12Sub(_xOp1,_xOp2) MTH_M_xsub(_xOp1,_xOp2)
|
|
#define SCA_sw12_M_sw12Mul(_xOp1,_xOp2) MTH_M_xMul(_xOp1,_xOp2)
|
|
#define SCA_sw12_M_sw12Div(_xOp1,_xOp2) MTH_M_xDiv(_xOp1,_xOp2)
|
|
|
|
#define SCA_sw12_M_sw12Abs(_xOp) MTH_M_xAbs(_xOp)
|
|
#define SCA_sw12_M_sw12NegAbs(_xOp) MTH_M_xNegAbs(_xOp)
|
|
#define SCA_sw12_M_sw12Inv(_xOp) MTH_M_xInv(_xOp)
|
|
#define SCA_sw12_M_sw12Sqr(_xOp) MTH_M_xSqr(_xOp,_xOp)
|
|
#define SCA_sw12_M_sw12Cub(_xOp) MTH_M_xMul(_xOp,MTH_M_xSqr(_xOp))
|
|
#define SCA_sw12_M_sw12Sqrt(_xOp) MTH_M_xSqrt(_xOp)
|
|
#define SCA_sw12_M_sw12InvSqrt(_xOp) MTH_M_xInvSqrt(_xOp)
|
|
|
|
#define SCA_sw12_M_sw12Sin(_xOp) MTH_M_xSin(_xOp)
|
|
#define SCA_sw12_M_sw12Cos(_xOp) MTH_M_xSin(_xOp)
|
|
/*
|
|
#define sw12_M_Tan(_xOp) (SCA_sw12_fn_Tan(_xOp))
|
|
#define sw12_M_ASin(_xOp) (SCA_sw12_fn_ASin(_xOp))
|
|
#define sw12_M_ACos(_xOp) (SCA_sw12_fn_ACos(_xOp))
|
|
*/
|
|
/*
|
|
#define sw12_M_Sin(_xOp) SCA_sw12_M_sw12DoubleToReal(sin(sw12_M_Real2Double(_xOp)))
|
|
#define sw12_M_Cos(_xOp) SCA_sw12_M_sw12DoubleToReal(cos(sw12_M_Real2Double(_xOp)))
|
|
*/
|
|
|
|
#define SCA_sw12_M_sw12Tan(_xOp) MTH_M_xTan(_xOp)
|
|
#define SCA_sw12_M_sw12ASin(_xOp) MTH_M_xASin(_xOp)
|
|
#define SCA_sw12_M_sw12ACos(_xOp) MTH_M_xACos(_xOp)
|
|
|
|
|
|
/* ##-##############################
|
|
## Tools for MulMatrixMatrix 3D
|
|
################################# */
|
|
|
|
/* ##M==================================================================================
|
|
NAME : SCA_sw12_M_sw12MulSubMul
|
|
DESCRIPTION : Return the subtraction of two multiplications
|
|
INPUT : a, b, c, d : SCA_td_sw12
|
|
OUTPUT : a*b - c*d : SCA_td_sw12
|
|
=======================================================================================*/
|
|
#define SCA_sw12_M_sw12MulSubMul(a, b, c, d) MTH_M_xMulSubMul(a, b, c, d)
|
|
|
|
/* ##M==================================================================================
|
|
NAME : SCA_sw12_M_sw12MulAddMulAddMul
|
|
DESCRIPTION : Return the adition of three multiplications
|
|
INPUT : a, b, c, d, e, f : SCA_td_sw12
|
|
OUTPUT : a*b + c*d + e*f : SCA_td_sw12
|
|
=======================================================================================*/
|
|
#define SCA_sw12_M_sw12MulAddMulAddMul(a, b, c, d, e, f) MTH_M_xMulAddMulAddMul(a, b, c, d, e, f)
|
|
|
|
/* ##M==================================================================================
|
|
NAME : SCA_sw12_M_sw12SqrAddSqrAddSqr
|
|
DESCRIPTION : Return the adition of three squares
|
|
INPUT : a, b, c : SCA_td_sw12
|
|
OUTPUT : a*a + b*b + c*c : SCA_td_sw12
|
|
=======================================================================================*/
|
|
#define SCA_sw12_M_sw12SqrAddSqrAddSqr(a, b, c) MTH_M_xSqrAddSqrAddSqr(a, b, c)
|
|
|
|
/* ##M==================================================================================
|
|
NAME : SCA_sw12_M_sw12Mul3
|
|
DESCRIPTION : Return the multiplication of three real numbers
|
|
INPUT : a, b, c : SCA_td_sw12
|
|
OUTPUT : a*b*c : SCA_td_sw12
|
|
=======================================================================================*/
|
|
#define SCA_sw12_M_sw12Mul3(a, b, c) MTH_M_xMul3(a, b, c)
|
|
|
|
/* ##M==================================================================================
|
|
NAME : SCA_sw12_M_sw12Add3
|
|
DESCRIPTION : Return the addition of three real numbers
|
|
INPUT : a, b, c : SCA_td_sw12
|
|
OUTPUT : a+b+c : SCA_td_sw12
|
|
=======================================================================================*/
|
|
#define SCA_sw12_M_sw12Add3(a, b, c) MTH_M_xAdd3(a, b, c)
|
|
|
|
/*----------------------------------------------------------------------------------*/
|
|
|
|
#endif /* _SCA_sw12_H_ */
|
|
|