autotools: Update list of files to compile

Also remove some forgotten files from the repository
floating-point
Günther Brammer 2012-05-14 16:40:16 +02:00
parent 2b9a1778b3
commit 8156123a26
6 changed files with 4 additions and 9474 deletions

View File

@ -121,11 +121,6 @@ src/c4group/CStdFile.cpp \
src/c4group/CStdFile.h \
src/lib/C4InputValidation.cpp \
src/lib/C4InputValidation.h \
src/lib/C4RealImpl_Fixed.cpp \
src/lib/C4RealImpl_Fixed.h \
src/lib/C4RealImpl_FPU.h \
src/lib/C4RealImpl_SSE.cpp \
src/lib/C4RealImpl_SSE.h \
src/lib/SHA1.h \
src/lib/Standard.cpp \
src/lib/Standard.h \
@ -520,6 +515,8 @@ src/script/C4AulFunc.h \
src/script/C4Aul.h \
src/script/C4AulLink.cpp \
src/script/C4AulParse.cpp \
src/script/C4Numeric.cpp \
src/script/C4Numeric.h \
src/script/C4PropList.cpp \
src/script/C4PropList.h \
src/script/C4Script.cpp \
@ -533,6 +530,7 @@ src/script/C4Value.cpp \
src/script/C4Value.h \
src/script/C4ValueMap.cpp \
src/script/C4ValueMap.h \
thirdparty/simdmath/sse_mathfun.h \
thirdparty/timsort/sort.h \
thirdparty/tinyxml/tinystr.cpp \
thirdparty/tinyxml/tinystr.h \
@ -694,6 +692,7 @@ src/script/C4Aul.cpp \
src/script/C4AulExec.cpp \
src/script/C4AulLink.cpp \
src/script/C4AulParse.cpp \
src/script/C4Numeric.cpp \
src/script/C4StringTable.cpp \
src/script/C4PropList.cpp \
src/script/C4ScriptHost.cpp \

View File

@ -1,82 +0,0 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 2010 Nicolas Hake
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
/* Fixed point math extracted from ALLEGRO by Shawn Hargreaves */
#ifndef INC_RealImpl_FPU
#define INC_RealImpl_FPU
#ifndef INC_C4Real
#error C4RealImpl_FPU.h must not be included by itself; include C4Real.h instead
#endif
#ifdef _MSC_VER
# define _USE_MATH_DEFINES
#endif
#include <cmath>
inline C4Real_FPU_Float Sin(const C4Real_FPU_Float &real)
{
return std::sin(real.value * static_cast<float>(M_PI) / 180.0f);
}
inline C4Real_FPU_Float Cos(const C4Real_FPU_Float &real)
{
return std::cos(real.value * static_cast<float>(M_PI) / 180.0f);
}
inline C4Real_FPU_Float Pow(const C4Real_FPU_Float &x, const C4Real_FPU_Float &y)
{
return std::pow(x.value, y.value);
}
// Overload to avoid conversion warning
template<>
inline C4Real_FPU_Float::operator bool () const
{
return value != 0.0f;
}
// C4Real_Fixed rounds up. Why?
#ifdef _M_X64
#include <xmmintrin.h>
#endif
template<>
inline C4Real_FPU_Float::operator int () const
{
float y = value;
#if defined _M_X64
*reinterpret_cast<int*>(&y) |= 1;
return _mm_cvtss_si32(_mm_load_ss(&y));
#elif defined _MSC_VER
int e;
_asm
{
or y,1;
fld y;
fistp e;
}
return e;
#elif defined __GNUC__
int e;
asm ("or $1, %0" : "+rom" (y));
asm ("fistp%z0 %0" : "=om" (e) : "t" (y) : "st");
return e;
#else
#error Unknown processor; implement rounding here
#endif
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,190 +0,0 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 1998-2000 Matthes Bender
* Copyright (c) 2002, 2005 Sven Eberhardt
* Copyright (c) 2002, 2004-2005, 2007 Peter Wortmann
* Copyright (c) 2005, 2007 Günther Brammer
* Copyright (c) 2010 Nicolas Hake
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
/* Fixed point math extracted from ALLEGRO by Shawn Hargreaves */
#ifndef INC_RealImpl_Fixed
#define INC_RealImpl_Fixed
#ifndef INC_C4Real
#error C4RealImpl_Fixed.h must not be included by itself; include C4Real.h instead
#endif
#define FIXED_EMULATE_64BIT
#include <boost/operators.hpp>
class C4RealImpl_Fixed
: boost::totally_ordered<C4RealImpl_Fixed,
boost::equivalent<C4RealImpl_Fixed
> >
{
// fixpoint shift (check 64 bit emulation before changing!)
static const int32_t FIXED_SHIFT = 16;
static const int32_t FIXED_FPF = 1 << FIXED_SHIFT;
int32_t val; // Internal value
static long SineTable[9001]; // external table of sine values
public:
struct StorageType { int32_t v; };
friend bool operator==(StorageType lhs, StorageType rhs) { return lhs.v == rhs.v; }
inline C4RealImpl_Fixed() : val(0) {}
inline C4RealImpl_Fixed(const C4RealImpl_Fixed &rhs) : val(rhs.val) {}
explicit inline C4RealImpl_Fixed(int32_t iVal) : val (iVal * FIXED_FPF) { }
explicit inline C4RealImpl_Fixed(int32_t iVal, int32_t iPrec)
: val( iPrec < FIXED_FPF
? iVal * (FIXED_FPF / iPrec) + (iVal * (FIXED_FPF % iPrec)) / iPrec
: int32_t( int64_t(iVal) * FIXED_FPF / iPrec )
)
{ }
explicit inline C4RealImpl_Fixed(float fVal)
: val(static_cast<int32_t>(fVal * float(FIXED_FPF)))
{ }
inline C4RealImpl_Fixed(StorageType rhs) : val(rhs.v) {}
operator StorageType() const { StorageType nrv = {val}; return nrv; }
int32_t to_int() const
{
int32_t r = val;
// be careful not to overflow
r += (val <= 0x7fffffff - FIXED_FPF / 2) * FIXED_FPF / 2;
// ensure that -x.50 is rounded to -(x+1)
r -= (val < 0);
r >>= FIXED_SHIFT;
// round 32767.5 to 32768 (not that anybody cares)
r += (val > 0x7fffffff - FIXED_FPF / 2);
return r;
}
int32_t to_int(int32_t prec) const
{
int64_t r = val;
r *= prec;
r += FIXED_FPF / 2;
r -= (val < 0);
r >>= FIXED_SHIFT;
return int32_t(r);
}
// convert to floating point value
float to_float() const
{
return float(val) / float(FIXED_FPF);
}
// Arithmetics.
C4RealImpl_Fixed &operator += (const C4RealImpl_Fixed &rhs)
{
val += rhs.val;
return *this;
}
C4RealImpl_Fixed &operator -= (const C4RealImpl_Fixed &rhs)
{
val -= rhs.val;
return *this;
}
C4RealImpl_Fixed &operator *= (const C4RealImpl_Fixed &rhs)
{
#ifndef FIXED_EMULATE_64BIT
val = int32_t( (int64_t(val) * rhs.val) / FIXED_FPF );
#else
int32_t x0 = val & (FIXED_FPF - 1),
x1 = val >> FIXED_SHIFT;
int32_t y0 = rhs.val & (FIXED_FPF - 1),
y1 = rhs.val >> FIXED_SHIFT;
val = x0*y0/FIXED_FPF + x0*y1 + x1*y0 + x1*y1*FIXED_FPF;
#endif
return *this;
}
C4RealImpl_Fixed &operator /= (const C4RealImpl_Fixed &rhs)
{
val = int32_t( (int64_t(val) * FIXED_FPF) / rhs.val );
return *this;
}
C4RealImpl_Fixed operator - ()
{
C4RealImpl_Fixed nrv(*this);
nrv.val = -nrv.val;
return nrv;
}
C4RealImpl_Fixed sin_deg() const
{
// adjust angle
int32_t v=int32_t((int64_t(val)*100)/FIXED_FPF); if (v<0) v=18000-v; v%=36000;
// get sine
C4RealImpl_Fixed fr;
switch (v/9000)
{
case 0: fr.val=+SineTable[v]; break;
case 1: fr.val=+SineTable[18000-v]; break;
case 2: fr.val=-SineTable[v-18000]; break;
case 3: fr.val=-SineTable[36000-v]; break;
}
return fr;
}
C4RealImpl_Fixed cos_deg() const
{
// adjust angle
int32_t v=int32_t((int64_t(val)*100)/FIXED_FPF); if (v<0) v=-v; v%=36000;
// get cosine
C4RealImpl_Fixed fr;
switch (v/9000)
{
case 0: fr.val=+SineTable[9000-v]; break;
case 1: fr.val=-SineTable[v-9000]; break;
case 2: fr.val=-SineTable[27000-v]; break;
case 3: fr.val=+SineTable[v-27000]; break;
}
return fr;
}
// Comparison
bool operator < (const C4RealImpl_Fixed &rhs) const { return val < rhs.val; }
operator bool () const { return val != 0; }
// Conversion
operator float () const { return to_float(); }
operator int () const { return to_int(); }
};
// Avoid overflowing
template<>
inline C4RealBase<C4RealImpl_Fixed>::C4RealBase(int32_t val, int32_t prec)
: value(val, prec)
{}
inline C4Real_Fixed Sin(const C4Real_Fixed &real)
{
C4Real_Fixed nrv;
nrv.value = real.value.sin_deg();
return nrv;
}
inline C4Real_Fixed Cos(const C4Real_Fixed &real)
{
C4Real_Fixed nrv;
nrv.value = real.value.cos_deg();
return nrv;
}
#endif

View File

@ -1,52 +0,0 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 2010 Nicolas Hake
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#include "C4Include.h"
#include "C4Real.h"
namespace
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4305) // 'identifier' : truncation from 'type1' to 'type2'
#endif
#ifdef _M_X64
# define USE_SSE2
#endif
#include "simdmath/sse_mathfun.h"
#ifdef _MSC_VER
# pragma warning(pop)
#endif
const __m128 deg2rad = _mm_set_ps1(0.017453292f);
}
C4Real_SSE_Float Sin(const C4Real_SSE_Float &real)
{
return C4RealImpl_SSE(sin_ps(_mm_mul_ps(real.value.value, deg2rad)));
}
C4Real_SSE_Float Cos(const C4Real_SSE_Float &real)
{
return C4RealImpl_SSE(cos_ps(_mm_mul_ps(real.value.value, deg2rad)));
}
C4Real_SSE_Float Pow(const C4Real_SSE_Float &x, const C4Real_SSE_Float &y)
{
C4RealImpl_SSE val;
val.value = log_ps(x.value.value);
val *= y.value;
val.value = exp_ps(val.value);
return val;
}

View File

@ -1,118 +0,0 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 2010 Nicolas Hake
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#ifndef INC_RealImpl_SSE
#define INC_RealImpl_SSE
#ifndef INC_C4Real
#error C4RealImpl_SSE.h must not be included by itself; include C4Real.h instead
#include "C4Real.h"
#endif
#include <cassert>
#include <xmmintrin.h>
class C4RealImpl_SSE
{
friend C4Real_SSE_Float Sin(const C4Real_SSE_Float &);
friend C4Real_SSE_Float Cos(const C4Real_SSE_Float &);
friend C4Real_SSE_Float Pow(const C4Real_SSE_Float &, const C4Real_SSE_Float &);
__m128 value;
C4RealImpl_SSE Pow(const C4RealImpl_SSE &y) const; // power function
inline C4RealImpl_SSE(__m128 rhs)
: value(rhs)
{}
public:
inline C4RealImpl_SSE()
: value(_mm_setzero_ps())
{}
inline C4RealImpl_SSE(const C4RealImpl_SSE &rhs)
: value(rhs.value)
{}
inline C4RealImpl_SSE(int32_t iVal)
: value(_mm_cvtsi32_ss(value, iVal))
{}
inline C4RealImpl_SSE(float fVal)
: value(_mm_set_ss(fVal))
{}
inline C4RealImpl_SSE(const C4Real_SSE_Float &rhs)
: value(rhs.value.value)
{}
operator int () const
{
return _mm_cvttss_si32(value);
}
operator float () const
{
float f;
_mm_store_ss(&f, value);
return f;
}
// To store C4RealImpl_SSE into unions, we're using an anonymous struct
// to distinguish types, and an int32_t inside that struct to avoid passing
// parameters via the x87 stack.
struct StorageType { int32_t v; };
friend bool operator==(StorageType lhs, StorageType rhs) { return lhs.v == rhs.v; }
inline C4RealImpl_SSE(StorageType rhs)
: value(_mm_load_ss(reinterpret_cast<float*>(&rhs.v)))
{}
operator StorageType() const
{
StorageType nrv;
_mm_store_ss(reinterpret_cast<float*>(&nrv.v), value);
return nrv;
}
// Arithmetics
// We're using _ps intrinsics for everything except division because they
// have the same latency as their _ss counterparts, but their representa-
// tion is one byte shorter (0F xx instead of F3 0F xx).
// DIVPS is about half as fast as DIVSS, so we use the scalar instruction
// here.
C4RealImpl_SSE &operator += (const C4RealImpl_SSE &rhs) { value = _mm_add_ps(value, rhs.value); return *this; }
C4RealImpl_SSE &operator -= (const C4RealImpl_SSE &rhs) { value = _mm_sub_ps(value, rhs.value); return *this; }
C4RealImpl_SSE &operator *= (const C4RealImpl_SSE &rhs) { value = _mm_mul_ps(value, rhs.value); return *this; }
C4RealImpl_SSE &operator /= (const C4RealImpl_SSE &rhs) { value = _mm_div_ss(value, rhs.value); return *this; }
// Negation
C4RealImpl_SSE operator - () const
{
C4RealImpl_SSE nrv;
nrv -= *this;
return nrv;
}
// Comparison
// COMISS is faster on newer CPUs than CMPSS, also we get a nice return
// value from the intrinsic instead of having to store parts of the XMM
// register to a variable to read.
bool operator < (const C4RealImpl_SSE &rhs) const { return _mm_comilt_ss(value, rhs.value) != 0; }
bool operator <= (const C4RealImpl_SSE &rhs) const { return _mm_comile_ss(value, rhs.value) != 0; }
bool operator == (const C4RealImpl_SSE &rhs) const { return _mm_comieq_ss(value, rhs.value) != 0; }
bool operator >= (const C4RealImpl_SSE &rhs) const { return _mm_comige_ss(value, rhs.value) != 0; }
bool operator > (const C4RealImpl_SSE &rhs) const { return _mm_comigt_ss(value, rhs.value) != 0; }
bool operator != (const C4RealImpl_SSE &rhs) const { return _mm_comineq_ss(value, rhs.value) != 0; }
operator bool () const { return _mm_comineq_ss(value, _mm_setzero_ps()) != 0; }
bool operator ! () const { return _mm_comieq_ss(value, _mm_setzero_ps()) != 0; }
};
#endif