238 lines
10 KiB
C
238 lines
10 KiB
C
/*----------------------------------------------------------------------------------*/
|
|
/* Filename : SCA_sw.h */
|
|
/* Author : Frederic Philippe */
|
|
/* : Marc Trabucato */
|
|
/* Target : PC */
|
|
/*----------------------------------------------------------------------------------*/
|
|
|
|
/* -----------------15/04/98 17:45-------------------
|
|
* Conversion : OK (avec version 23.04.98 19:26 (18823))
|
|
* --------------------------------------------------*/
|
|
#ifndef _SCA_sw_H_
|
|
#define _SCA_sw_H_
|
|
|
|
/*----------------------------------------------------------------------------------*/
|
|
|
|
/* New */
|
|
/*-----------------*/
|
|
/* Fixed coma case */
|
|
/*-----------------*/
|
|
/* 1.15.0 */
|
|
|
|
/*---------------------------------*/
|
|
/* Specific Values for fixed point */
|
|
/*---------------------------------*/
|
|
#define SCA_td_sw MTH_tdxReal
|
|
|
|
/*#define SCA_sw_C_swComaDecal 0*/
|
|
/*#define SCA_sw_C_swComaCoef 1*/
|
|
|
|
/*#define SCA_sw_C_dfMax 32768*/
|
|
/*#define SCA_sw_C_dfMin (-SCA_sw_C_dfMax)*/
|
|
|
|
/*#define SCA_sw_C_swMax 32767*/
|
|
/*#define SCA_sw_C_swMin -32767*/
|
|
/*#define SCA_sw_C_swError -32768*/
|
|
|
|
/*#define SCA_sw_C_swNegMask (0x8000)*/
|
|
/*#define SCA_sw_C_swPosMask (0x7FFF)*/
|
|
/*#define SCA_sw_C_swDecMask (0x0000)*/
|
|
/*#define SCA_sw_C_swEntMask (0xFFFF)*/
|
|
|
|
/*--------------------------------------------------------*/
|
|
/* ---------------- Constants ---------------------------*/
|
|
/*--------------------------------------------------------*/
|
|
#define SCA_sw_C_ZERO MTH_C_ZERO
|
|
#define SCA_sw_C_ONE MTH_C_ONE
|
|
|
|
|
|
/*--------------------------------------------------------*/
|
|
/* Conversion functions */
|
|
/*--------------------------------------------------------*/
|
|
__inline SCA_td_sw SCA_sw_fn_swDouble2Real( double _dfValue )
|
|
{
|
|
return MTH_M_xDoubleToReal( _dfValue );
|
|
}
|
|
/*--------------------------------------------------------*/
|
|
__inline double SCA_sw_fn_Real2Double( SCA_td_sw _xValue )
|
|
{
|
|
return MTH_M_xRealToDouble( _xValue );
|
|
}
|
|
|
|
/*--------------------------------------------*/
|
|
/* Conversions : Macros definitions */
|
|
/*--------------------------------------------*/
|
|
#define SCA_sw_M_swDoubleToReal(_dfValue) MTH_M_xDoubleToReal(_dfValue)
|
|
#define SCA_sw_M_swFloatToReal(_fValue) MTH_M_xFloatToReal(_fValue)
|
|
#define SCA_sw_M_swIntToReal(_iValue) MTH_M_xLongToReal(_iValue) /*???*/
|
|
|
|
#define SCA_sw_M_RealToDouble(_xValue) MTH_M_xRealToDouble(_xValue)
|
|
#define SCA_sw_M_RealToFloat(_xValue) MTH_M_xrealToFloat(_xValue)
|
|
#define SCA_sw_M_RealToInt(_xValue) MTh_M_xRealToLong(_xValue) /*???*/
|
|
|
|
/*--------------------------------------------------------*/
|
|
/* Constantes */
|
|
/*--------------------------------------------------------*/
|
|
#define SCA_sw_C_swTwo MTH_C_2
|
|
|
|
/* ##CONSTANTE#--------------------------------------------------------------------------
|
|
Real Constantes declaration
|
|
---------------------------------------------------------------------------------------*/
|
|
|
|
#define SCA_sw_C_InfinitPlus MTH_C_InfinitPlus
|
|
#define SCA_sw_InfinitMinus MTH_C_InfinitMinus
|
|
#define SCA_sw_EpsilonPlus MTH_C_EpsilonPlus
|
|
#define SCA_sw_EpsilonMinus MTH_C_EpsilonMinus
|
|
|
|
#define SCA_sw_Pi MTH_C_Pi
|
|
#define SCA_sw_2Pi MTH_C_2Pi
|
|
#define SCA_sw_PiBy2 MTH_C_PiBy2
|
|
#define SCA_sw_PiBy4 MTH_C_PiBy4
|
|
#define SCA_sw_PiBy8 MTH_C_PiBy8
|
|
#define SCA_sw_PiBy180 MTH_C_PiBy180
|
|
#define SCA_sw_180ByPi MTH_C_180ByPi
|
|
#define SCA_sw_e MTH_C_e
|
|
|
|
#define SCA_sw_MinusONE MTH_C_MinusONE
|
|
|
|
#define SCA_sw_2 MTH_C_2
|
|
#define SCA_sw_3 MTH_C_3
|
|
#define SCA_sw_4 MTH_C_4
|
|
#define SCA_sw_5 MTH_C_5
|
|
#define SCA_sw_8 (double) 8.0
|
|
|
|
#define SCA_sw_Minus2 MTH_C_Minus2
|
|
#define SCA_sw_Minus3 MTH_C_Minus3
|
|
#define SCA_sw_Minus4 MTH_C_Minus4
|
|
#define SCA_sw_Minus5 MTH_C_Minus5
|
|
|
|
#define SCA_sw_Inv2 MTH_C_Inv2
|
|
#define SCA_sw_Inv3 MTH_C_Inv3
|
|
#define SCA_sw_Inv4 MTH_C_Inv4
|
|
#define SCA_sw_Inv5 MTH_C_Inv5
|
|
|
|
#define SCA_sw_MinusInv2 MTH_C_MinusInv2
|
|
#define SCA_sw_MinusInv3 MTH_C_MinusInv3
|
|
#define SCA_sw_MinusInv4 MTH_C_MinusInv4
|
|
#define SCA_sw_MinusInv5 MTH_C_MinusInv5
|
|
|
|
#define SCA_sw_Sqrt2 MTH_C_Sqrt2
|
|
#define SCA_sw_Sqrt3 MTH_C_Sqrt3
|
|
#define SCA_sw_Sqrt4 MTH_C_Sqrt4
|
|
#define SCA_sw_Sqrt5 MTH_C_Sqrt5
|
|
|
|
#define SCA_sw_MinusSqrt2 MTH_C_MinusSqrt2
|
|
#define SCA_sw_MinusSqrt3 MTH_C_MinusSqrt3
|
|
#define SCA_sw_MinusSqrt4 MTH_C_MinusSqrt4
|
|
#define SCA_sw_MinusSqrt5 MTH_C_MinusSqrt5
|
|
|
|
#define SCA_sw_InvSqrt2 MTH_C_InvSqrt2
|
|
#define SCA_sw_InvSqrt3 MTH_C_InvSqrt3
|
|
#define SCA_sw_InvSqrt4 MTH_C_InvSqrt4
|
|
#define SCA_sw_InvSqrt5 MTH_C_InvSqrt5
|
|
|
|
#define SCA_sw_MinusInvSqrt2 MTH_C_MinusInvSqrt2
|
|
#define SCA_sw_MinusInvSqrt3 MTH_C_MinusInvSqrt3
|
|
#define SCA_sw_MinusInvSqrt4 MTH_C_MinusInvSqrt4
|
|
#define SCA_sw_MinusInvSqrt5 MTH_C_MinusInvSqrt5
|
|
|
|
#define SCA_sw_MAX_UNSIGNED_CHAR MTH_C_MAX_UNSIGNED_CHAR
|
|
|
|
/*--------------------------------------------------------*/
|
|
/* Operations */
|
|
/*--------------------------------------------------------*/
|
|
/* Comparaisons */
|
|
#define SCA_sw_M_bIsNull(_xOp) MTH_M_bIsNull(_xOp)
|
|
#define SCA_sw_M_bEqualZero(_xOp) MTH_M_bEqualZero(_xOp)
|
|
#define SCA_sw_M_bIsNegative(_xOp) MTH_M_bLessZero(_xOp)
|
|
#define SCA_sw_M_bIsPositive(_xOp) MTH_M_bGreaterZero(_xOp)
|
|
#define SCA_sw_M_bGreater(_xOp1,_xOp2) MTH_M_bGreater(_xOp1,_xOp2)
|
|
#define SCA_sw_M_bLess(_xOp1,_xOp2) MTH_M_bLess_xOp1,_xOp2)
|
|
#define SCA_sw_M_bGreaterEqual(_xOp1,_xOp2) MTH_M_bGreaterEqual(_xOp1,_xOp2)
|
|
#define SCA_sw_M_bLessEqual(_xOp1,_xOp2) MTH_M_bLessEqual(_xOp1,_xOp2)
|
|
#define SCA_sw_M_bEqual(_xOp1,_xOp2) MTH_M_bEqual(_xOp1,_xOp2)
|
|
#define SCA_sw_M_bDifferent(_xOp1,_xOp2) MTH_M_bDifferent(_xOp1,_xOp2)
|
|
#define SCA_sw_M_swMax(A,B) MTH_M_xMax(A,B)
|
|
#define SCA_sw_M_swMin(A,B) MTH_M_xMin(A,B)
|
|
|
|
|
|
/* Operations */
|
|
#define SCA_sw_M_swNeg(_xOp) MTH_M_xNeg(_xOp)
|
|
#define SCA_sw_M_swAdd(_xOp1,_xOp2) MTH_M_xAdd(_xOp1,_xOp2)
|
|
#define SCA_sw_M_swSub(_xOp1,_xOp2) MTH_M_xsub(_xOp1,_xOp2)
|
|
#define SCA_sw_M_swMul(_xOp1,_xOp2) MTH_M_xMul(_xOp1,_xOp2)
|
|
#define SCA_sw_M_swDiv(_xOp1,_xOp2) MTH_M_xDiv(_xOp1,_xOp2)
|
|
|
|
#define SCA_sw_M_swAbs(_xOp) MTH_M_xAbs(_xOp)
|
|
#define SCA_sw_M_swNegAbs(_xOp) MTH_M_xNegAbs(_xOp)
|
|
#define SCA_sw_M_swInv(_xOp) MTH_M_xInv(_xOp)
|
|
#define SCA_sw_M_swSqr(_xOp) MTH_M_xSqr(_xOp,_xOp)
|
|
#define SCA_sw_M_swCub(_xOp) MTH_M_xMul(_xOp,MTH_M_xSqr(_xOp))
|
|
#define SCA_sw_M_swSqrt(_xOp) MTH_M_xSqrt(_xOp)
|
|
#define SCA_sw_M_swInvSqrt(_xOp) MTH_M_xInvSqrt(_xOp)
|
|
|
|
#define SCA_sw_M_swSin(_xOp) MTH_M_xSin(_xOp)
|
|
#define SCA_sw_M_swCos(_xOp) MTH_M_xSin(_xOp)
|
|
/*
|
|
#define sw_M_Tan(_xOp) (SCA_sw_fn_Tan(_xOp))
|
|
#define sw_M_ASin(_xOp) (SCA_sw_fn_ASin(_xOp))
|
|
#define sw_M_ACos(_xOp) (SCA_sw_fn_ACos(_xOp))
|
|
*/
|
|
/*
|
|
#define sw_M_Sin(_xOp) SCA_sw_M_swDoubleToReal(sin(sw_M_Real2Double(_xOp)))
|
|
#define sw_M_Cos(_xOp) SCA_sw_M_swDoubleToReal(cos(sw_M_Real2Double(_xOp)))
|
|
*/
|
|
|
|
#define SCA_sw_M_swTan(_xOp) MTH_M_xTan(_xOp)
|
|
#define SCA_sw_M_swASin(_xOp) MTH_M_xASin(_xOp)
|
|
#define SCA_sw_M_swACos(_xOp) MTH_M_xACos(_xOp)
|
|
|
|
|
|
/* ##-##############################
|
|
## Tools for MulMatrixMatrix 3D
|
|
################################# */
|
|
|
|
/* ##M==================================================================================
|
|
NAME : SCA_sw_M_swMulSubMul
|
|
DESCRIPTION : Return the subtraction of two multiplications
|
|
INPUT : a, b, c, d : SCA_td_sw
|
|
OUTPUT : a*b - c*d : SCA_td_sw
|
|
=======================================================================================*/
|
|
#define SCA_sw_M_swMulSubMul(a, b, c, d) MTH_M_xMulSubMul(a, b, c, d)
|
|
|
|
/* ##M==================================================================================
|
|
NAME : SCA_sw_M_swMulAddMulAddMul
|
|
DESCRIPTION : Return the adition of three multiplications
|
|
INPUT : a, b, c, d, e, f : SCA_td_sw
|
|
OUTPUT : a*b + c*d + e*f : SCA_td_sw
|
|
=======================================================================================*/
|
|
#define SCA_sw_M_swMulAddMulAddMul(a, b, c, d, e, f) MTH_M_xMulAddMulAddMul(a, b, c, d, e, f)
|
|
|
|
/* ##M==================================================================================
|
|
NAME : SCA_sw_M_swSqrAddSqrAddSqr
|
|
DESCRIPTION : Return the adition of three squares
|
|
INPUT : a, b, c : SCA_td_sw
|
|
OUTPUT : a*a + b*b + c*c : SCA_td_sw
|
|
=======================================================================================*/
|
|
#define SCA_sw_M_swSqrAddSqrAddSqr(a, b, c) MTH_M_xSqrAddSqrAddSqr(a, b, c)
|
|
|
|
/* ##M==================================================================================
|
|
NAME : SCA_sw_M_swMul3
|
|
DESCRIPTION : Return the multiplication of three real numbers
|
|
INPUT : a, b, c : SCA_td_sw
|
|
OUTPUT : a*b*c : SCA_td_sw
|
|
=======================================================================================*/
|
|
#define SCA_sw_M_swMul3(a, b, c) MTH_M_xMul3(a, b, c)
|
|
|
|
/* ##M==================================================================================
|
|
NAME : SCA_sw_M_swAdd3
|
|
DESCRIPTION : Return the addition of three real numbers
|
|
INPUT : a, b, c : SCA_td_sw
|
|
OUTPUT : a+b+c : SCA_td_sw
|
|
=======================================================================================*/
|
|
#define SCA_sw_M_swAdd3(a, b, c) MTH_M_xAdd3(a, b, c)
|
|
|
|
/*----------------------------------------------------------------------------------*/
|
|
|
|
#endif /* _SCA_sw_H_ */
|