Something went wrong. Try again.
Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
2.1 kB · 74 lines
C
at android
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475/*This file is part of Darling.
Copyright (C) 2012-2013 Lubos Dolezel
Darling is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.
Darling is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.
You should have received a copy of the GNU General Public Licensealong with Darling. If not, see <http://www.gnu.org/licenses/>.*/
#ifndef FIXMATH_H#define FIXMATH_H#include "MacTypes.h"#include <stdint.h>
#ifdef __cplusplusextern "C" {#endif
float FixedToFloat(Fixed f);Fixed FloatToFixed(float f);
Fract FloatToFract(float f);float FractToFloat(Fract f);
Fixed FixRatio(short n, short denominator);Fixed FixMul(Fixed a, Fixed b);short FixRound(Fixed f);Fract Fix2Frac(Fixed f);int32_t Fix2Long(Fixed f);Fixed Long2Fix(int32_t v);Fixed Frac2Fix(Fract f);
Fract FracMul(Fract x, Fract y);Fixed FixDiv(Fixed x, Fixed y);Fract FracDiv(Fract x, Fract y);Fract FracSqrt(Fract x);Fract FracSin(Fixed x);Fract FracCos(Fixed x);Fixed FixATan2(int32_t x, int32_t y);
double Frac2X(Fract f);double Fix2X(Fract f);Fixed X2Fix(double d);Fract X2Frac(double d);
short WideCompare(const wide* a, const wide* b);wide* WideAdd(wide* dst, const wide* val);wide* WideSubtract(wide* dst, const wide* val);wide* WideNegate(wide* val);wide* WideShift(wide* dst, int32_t shift); // rounds upwardsuint32_t WideSquareRoot(const wide* val);wide* WideMultiply(int32_t a, int32_t b, wide* dst);int32_t WideDivide(const wide* divd, int32_t divs, int32_t* remainder);wide* WideWideDivide(wide* divd, int32_t divs, int32_t* remainder);wide* WideBitShift(wide* dst, int32_t shift);
UnsignedFixed UnsignedFixedMulDiv(UnsignedFixed a, UnsignedFixed mul, UnsignedFixed div);
#ifdef __cplusplus}#endif
#endif