Commit 848fd335 authored by Jordon Moss's avatar Jordon Moss
Browse files

Merge branch 'master' of voidpoint.io:terminx/eduke32

parents ef4d12b0 02eff8c8
synthesis:
script:
- kickoff_synthesis.sh
......@@ -526,14 +526,15 @@ ifeq ($(PLATFORM),WINDOWS)
ifneq ($(RELEASE),0)
ifeq ($(FORCEDEBUG),0)
DYNAMICBASE := ,--dynamicbase
DYNAMICBASE := -Wl,--dynamicbase
ifeq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
DYNAMICBASE := $(DYNAMICBASE),--high-entropy-va
endif
endif
endif
LINKERFLAGS += -Wl,--enable-auto-import,--nxcompat$(DYNAMICBASE)
LINKERFLAGS += -Wl,--enable-auto-import,--nxcompat $(DYNAMICBASE)
ifneq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
LINKERFLAGS += -Wl,--large-address-aware
else
LINKERFLAGS += -Wl,--high-entropy-va
endif
LUAJIT_BCOPTS := -o windows
......@@ -994,7 +995,12 @@ ifeq ($(PLATFORM),WINDOWS)
ifneq (0,$(GCC_PREREQ_4))
L_SSP := -lssp
endif
LIBS += -lmingwex -lgdi32 -lpthread
LIBS += -lmingwex -lgdi32
ifneq (0,$(CLANG))
LIBS += -pthread
else
LIBS += -lpthread
endif
ifeq ($(RENDERTYPE),WIN)
LIBS += -ldxguid
else ifeq ($(SDL_TARGET),1)
......
......@@ -776,6 +776,7 @@ sw_game_objs := \
hornet.cpp \
interp.cpp \
interpsh.cpp \
interpso.cpp \
inv.cpp \
jplayer.cpp \
jsector.cpp \
......
......@@ -149,7 +149,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>HAVE_ROUND;LIBXMP_CORE_PLAYER;LIBXMP_CORE_DISABLE_IT;BUILDING_STATIC;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_ROUND;LIBXMP_CORE_PLAYER;BUILDING_STATIC;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
......@@ -172,7 +172,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>HAVE_ROUND;LIBXMP_CORE_PLAYER;LIBXMP_CORE_DISABLE_IT;BUILDING_STATIC;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_ROUND;LIBXMP_CORE_PLAYER;BUILDING_STATIC;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
......@@ -196,7 +196,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HAVE_ROUND;LIBXMP_CORE_PLAYER;LIBXMP_CORE_DISABLE_IT;BUILDING_STATIC;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_ROUND;LIBXMP_CORE_PLAYER;BUILDING_STATIC;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
......@@ -222,7 +222,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HAVE_ROUND;LIBXMP_CORE_PLAYER;LIBXMP_CORE_DISABLE_IT;BUILDING_STATIC;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_ROUND;LIBXMP_CORE_PLAYER;BUILDING_STATIC;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
......
......@@ -208,6 +208,7 @@
<ClCompile Include="..\..\source\sw\src\hornet.cpp" />
<ClCompile Include="..\..\source\sw\src\interp.cpp" />
<ClCompile Include="..\..\source\sw\src\interpsh.cpp" />
<ClCompile Include="..\..\source\sw\src\interpso.cpp" />
<ClCompile Include="..\..\source\sw\src\inv.cpp" />
<ClCompile Include="..\..\source\sw\src\jbhlp.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
......@@ -327,6 +328,7 @@
<ClInclude Include="..\..\source\sw\src\GrpFile.game.h" />
<ClInclude Include="..\..\source\sw\src\grpscan.h" />
<ClInclude Include="..\..\source\sw\src\interp.h" />
<ClInclude Include="..\..\source\sw\src\interpso.h" />
<ClInclude Include="..\..\source\sw\src\inv.h" />
<ClInclude Include="..\..\source\sw\src\jnames.h" />
<ClInclude Include="..\..\source\sw\src\jsector.h" />
......@@ -374,4 +376,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -85,6 +85,9 @@
<ClCompile Include="..\..\source\sw\src\interpsh.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\sw\src\interpso.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\sw\src\inv.cpp">
<Filter>Source Files</Filter>
</ClCompile>
......@@ -333,6 +336,9 @@
<ClInclude Include="..\..\source\sw\src\interp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\sw\src\interpso.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\sw\src\inv.h">
<Filter>Header Files</Filter>
</ClInclude>
......@@ -463,4 +469,4 @@
<Filter>Header Files\midi</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -57,7 +57,7 @@ static int MixBufferCurrent;
static int MixBufferUsed;
static void (*MixCallBack)(void);
#if (SDL_MAJOR_VERSION == 2)
#if (SDL_MAJOR_VERSION >= 2)
static SDL_AudioDeviceID audio_dev;
#endif
......@@ -198,10 +198,10 @@ int SDLDrv_PCM_Init(int *mixrate, int *numchannels, void * initdata)
SDL_AudioSpec actual = {};
#if (SDL_MAJOR_VERSION == 1)
err = !SDL_OpenAudio(&spec, &actual);
#else
#if (SDL_MAJOR_VERSION >= 2)
audio_dev = err = SDL_OpenAudioDevice(nullptr, 0, &spec, &actual, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE);
#else
err = !SDL_OpenAudio(&spec, &actual);
#endif
#if SDL_MAJOR_VERSION >= 2
......@@ -216,11 +216,7 @@ int SDLDrv_PCM_Init(int *mixrate, int *numchannels, void * initdata)
return SDLErr_Error;
}
#if (SDL_MAJOR_VERSION == 1)
char drivernamestr[64] = "(error)";
SDL_AudioDriverName(drivernamestr, sizeof(drivernamestr));
MV_Printf("SDL %s driver", drivernamestr);
#else
#if (SDL_MAJOR_VERSION >= 2)
char *drivername = Xstrdup(SDL_GetCurrentAudioDriver());
for (int i=0;drivername[i] != 0;++i)
......@@ -241,9 +237,11 @@ int SDLDrv_PCM_Init(int *mixrate, int *numchannels, void * initdata)
Xfree(devname);
Xfree(drivername);
#endif
#else
char drivernamestr[64] = "(error)";
SDL_AudioDriverName(drivernamestr, sizeof(drivernamestr));
MV_Printf("SDL %s driver", drivernamestr);
#if (SDL_MAJOR_VERSION == 1)
if (actual.freq == 0 || actual.channels == 0)
{
// hack for when SDL said it opened the audio, but clearly didn't
......@@ -312,7 +310,7 @@ int SDLDrv_PCM_BeginPlayback(char *BufferStart, int BufferSize,
// prime the buffer
MixCallBack();
#if (SDL_MAJOR_VERSION == 2)
#if (SDL_MAJOR_VERSION >= 2)
SDL_PauseAudioDevice(audio_dev, 0);
#else
SDL_PauseAudio(0);
......@@ -327,7 +325,7 @@ void SDLDrv_PCM_StopPlayback(void)
if (!Initialised || !Playing)
return;
#if (SDL_MAJOR_VERSION == 2)
#if (SDL_MAJOR_VERSION >= 2)
SDL_PauseAudioDevice(audio_dev, 1);
#else
SDL_PauseAudio(1);
......@@ -338,7 +336,7 @@ void SDLDrv_PCM_StopPlayback(void)
void SDLDrv_PCM_Lock(void)
{
#if (SDL_MAJOR_VERSION == 2)
#if (SDL_MAJOR_VERSION >= 2)
SDL_LockAudioDevice(audio_dev);
#else
SDL_LockAudio();
......@@ -347,7 +345,7 @@ void SDLDrv_PCM_Lock(void)
void SDLDrv_PCM_Unlock(void)
{
#if (SDL_MAJOR_VERSION == 2)
#if (SDL_MAJOR_VERSION >= 2)
SDL_UnlockAudioDevice(audio_dev);
#else
SDL_UnlockAudio();
......
......@@ -133,7 +133,7 @@ static bool MV_Mix(VoiceNode * const voice, int const buffer)
// beyond the length of the sample block
if ((position + bufsiz) >= voclen)
{
if (position >= voclen)
if (position >= voclen - voice->channels)
{
voice->GetSound(voice);
break;
......@@ -145,7 +145,7 @@ static bool MV_Mix(VoiceNode * const voice, int const buffer)
voice->position = voice->mix(voice, mixlen);
length -= mixlen;
if (voice->position >= voclen)
if (voice->position >= voclen - voice->channels)
{
// Get the next block of sound
if (voice->GetSound(voice) == NoMoreData)
......
......@@ -1301,6 +1301,12 @@ int32_t krand(void);
int32_t ksqrt(uint32_t num);
int32_t LUNATIC_FASTCALL getangle(int32_t xvect, int32_t yvect);
fix16_t LUNATIC_FASTCALL gethiq16angle(int32_t xvect, int32_t yvect);
static FORCE_INLINE fix16_t LUNATIC_FASTCALL getq16angle(int32_t xvect, int32_t yvect)
{
return fix16_from_int(getangle(xvect, yvect));
}
static FORCE_INLINE CONSTEXPR uint32_t uhypsq(int32_t const dx, int32_t const dy)
{
......
......@@ -11,7 +11,7 @@
// GrowArray - heap-allocated storage that can expand at runtime
// requirements: type must work properly with realloc -- otherwise, use std::vector
template <typename T, size_t increment_ = 1, typename = enable_if_t<std::is_pod<T>::value>, typename = enable_if_t<(increment_ > 0)>>
template <typename T, size_t increment_ = 1, typename = enable_if_t<std::is_standard_layout<T>::value>, typename = enable_if_t<std::is_trivial<T>::value>, typename = enable_if_t<(increment_ > 0)>>
struct GrowArray
{
FORCE_INLINE T * begin() const { return data_; }
......
......@@ -66,7 +66,9 @@
# define CSTD 0
#endif
#if defined __cplusplus && __cplusplus >= 201703L
#if defined __cplusplus && __cplusplus >= 202002L
# define CXXSTD 2020
#elif defined __cplusplus && __cplusplus >= 201703L
# define CXXSTD 2017
#elif defined __cplusplus && __cplusplus >= 201402L
# define CXXSTD 2014
......
......@@ -43,15 +43,14 @@ extern "C" {
#if defined(__i386__) || defined(__x86_64__)
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
__inline__ static void trap_instruction(void)
static FORCE_INLINE void trap_instruction(void)
{
__asm__ volatile("int $0x03");
}
#elif defined(__thumb__)
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
/* FIXME: handle __THUMB_INTERWORK__ */
__attribute__((gnu_inline, always_inline))
__inline__ static void trap_instruction(void)
static FORCE_INLINE void trap_instruction(void)
{
/* See 'arm-linux-tdep.c' in GDB source.
* Both instruction sequences below work. */
......@@ -82,8 +81,7 @@ __inline__ static void trap_instruction(void)
}
#elif defined(__arm__) && !defined(__thumb__)
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
__attribute__((gnu_inline, always_inline))
__inline__ static void trap_instruction(void)
static FORCE_INLINE void trap_instruction(void)
{
/* See 'arm-linux-tdep.c' in GDB source,
* 'eabi_linux_arm_le_breakpoint' */
......@@ -95,8 +93,7 @@ __inline__ static void trap_instruction(void)
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_BULTIN_TRAP
#elif defined(__aarch64__)
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
__attribute__((gnu_inline, always_inline))
__inline__ static void trap_instruction(void)
static FORCE_INLINE void trap_instruction(void)
{
/* See 'aarch64-tdep.c' in GDB source,
* 'aarch64_default_breakpoint' */
......@@ -105,8 +102,7 @@ __inline__ static void trap_instruction(void)
#elif defined(__powerpc__)
/* PPC 32 or 64-bit, big or little endian */
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
__attribute__((gnu_inline, always_inline))
__inline__ static void trap_instruction(void)
static FORCE_INLINE void trap_instruction(void)
{
/* See 'rs6000-tdep.c' in GDB source,
* 'rs6000_breakpoint' */
......@@ -127,21 +123,18 @@ __inline__ static void trap_instruction(void)
#ifndef DEBUG_BREAK_IMPL
#error "debugbreak.h is not supported on this target"
#elif DEBUG_BREAK_IMPL == DEBUG_BREAK_USE_TRAP_INSTRUCTION
__attribute__((gnu_inline, always_inline))
__inline__ static void debug_break(void)
static FORCE_INLINE void debug_break(void)
{
trap_instruction();
}
#elif DEBUG_BREAK_IMPL == DEBUG_BREAK_USE_BULTIN_TRAP
__attribute__((gnu_inline, always_inline))
__inline__ static void debug_break(void)
static FORCE_INLINE void debug_break(void)
{
__builtin_trap();
}
#elif DEBUG_BREAK_IMPL == DEBUG_BREAK_USE_SIGTRAP
#include <signal.h>
__attribute__((gnu_inline, always_inline))
__inline__ static void debug_break(void)
static FORCE_INLINE void debug_break(void)
{
raise(SIGTRAP);
}
......
......@@ -299,13 +299,15 @@ extern "C" {
ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT = 12,
ENET_PROTOCOL_COMMAND_COUNT = 13,
ENET_PROTOCOL_COMMAND_MASK = 0x0F
ENET_PROTOCOL_COMMAND_MASK = 0x0F,
ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7),
ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6),
ENET_PROTOCOL_COMMAND_FLAG_MASK = 0xC0
} ENetProtocolCommand;
typedef enum _ENetProtocolFlag {
ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7),
ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6),
ENET_PROTOCOL_HEADER_FLAG_COMPRESSED = (1 << 14),
ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15),
ENET_PROTOCOL_HEADER_FLAG_MASK = ENET_PROTOCOL_HEADER_FLAG_COMPRESSED | ENET_PROTOCOL_HEADER_FLAG_SENT_TIME,
......
......@@ -87,20 +87,17 @@ static inline int screentextGlyphIsTab(ScreenTextGlyph_t g)
return (g & SCREENTEXT_TAB) == SCREENTEXT_TAB;
}
enum ScreenTextFlags_t
{
TEXT_XRIGHT = 0x00000001,
TEXT_XCENTER = 0x00000002,
TEXT_YBOTTOM = 0x00000004,
TEXT_YCENTER = 0x00000008,
#define TEXT_XRIGHT (0x00000001)
#define TEXT_XCENTER (0x00000002)
#define TEXT_YBOTTOM (0x00000004)
#define TEXT_YCENTER (0x00000008)
TEXT_XOFFSETZERO = 0x00000100,
TEXT_XJUSTIFY = 0x00000200,
TEXT_YOFFSETZERO = 0x00000400,
TEXT_YJUSTIFY = 0x00000800,
#define TEXT_XOFFSETZERO (0x00000100)
#define TEXT_XJUSTIFY (0x00000200)
#define TEXT_YOFFSETZERO (0x00000400)
#define TEXT_YJUSTIFY (0x00000800)
TEXT_VARHEIGHT = 0x00800000,
};
#define TEXT_VARHEIGHT (0x00800000)
struct ScreenTextSize_t
{
......
......@@ -20,7 +20,7 @@ HINSTANCE win_gethinstance(void);
#include "sdlappicon.h"
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
#if (SDL_MAJOR_VERSION < 2 && SDL_MINOR_VERSION < 3) // SDL 1.2
int32_t SDL_WaitEventTimeout(SDL_Event *event, int32_t timeout);
#endif
......@@ -66,7 +66,7 @@ int32_t SDL_WaitEventTimeout(SDL_Event *event, int32_t timeout);
h = MAXYDIM; \
}
#if SDL_MAJOR_VERSION != 1
#if SDL_MAJOR_VERSION >= 2
#define SDL2_VIDEO_ERR(XX) \
{ \
initprintf("Unable to set video mode: " XX " failed: %s\n", SDL_GetError()); \
......
......@@ -598,7 +598,6 @@ int engineFPSLimit(void)
g_frameDelay = calcFrameDelay(r_maxfps, r_maxfpsoffset);
uint64_t const frameJitter = timerGetPerformanceFrequency() / 1000ull;
uint64_t frameTicks;
static uint64_t nextFrameTicks;
static uint64_t frameDelay;
......@@ -608,8 +607,8 @@ int engineFPSLimit(void)
nextFrameTicks = timerGetPerformanceCounter() + g_frameDelay;
frameDelay = g_frameDelay;
}
do { handleevents(); } while (nextFrameTicks - (frameTicks = timerGetPerformanceCounter()) < frameJitter);
handleevents();
frameTicks = timerGetPerformanceCounter();
if (nextFrameTicks - frameTicks > g_frameDelay)
{
......
......@@ -906,24 +906,36 @@ static int32_t defsparser(scriptfile *script)
break;
}
int32_t orig_crc32{};
if (have_crc32)
{
int32_t const orig_crc32 = tileGetCRC32(tile);
if (orig_crc32 != tile_crc32)
{
// initprintf("CRC32 of tile %d doesn't match! CRC32: %d, Expected: %d\n", tile, orig_crc32, tile_crc32);
break;
}
orig_crc32 = tileGetCRC32(tile);
if (orig_crc32 == tile_crc32)
have_crc32 = 0;
#if 0
else
initprintf("CRC32 of tile %d doesn't match! CRC32: %d, Expected: %d\n", tile, orig_crc32, tile_crc32);
#endif
}
vec2_16_t orig_size{};
if (have_size)
{
vec2_16_t const orig_size = tileGetSize(tile);
if (orig_size.x != tile_size.x && orig_size.y != tile_size.y)
{
// initprintf("Size of tile %d doesn't match! Size: (%d, %d), Expected: (%d, %d)\n", tile, orig_size.x, orig_size.y, tile_size.x, tile_size.y);
break;
}
orig_size = tileGetSize(tile);
if (orig_size.x == tile_size.x && orig_size.y == tile_size.y)
have_size = 0;
#if 0
else
initprintf("Size of tile %d doesn't match! Size: (%d, %d), Expected: (%d, %d)\n", tile, orig_size.x, orig_size.y, tile_size.x, tile_size.y);
#endif
}
if (have_crc32 || have_size)
{
#if 0
initprintf("tilefromtexture %d { ifmatch { size %d %d crc32 %d } }\n", tile, orig_size.x, orig_size.y, orig_crc32);
#endif
break;
}
if (!fn)
......
......@@ -11351,6 +11351,27 @@ int32_t LUNATIC_FASTCALL getangle(int32_t xvect, int32_t yvect)
return rv;
}
fix16_t LUNATIC_FASTCALL gethiq16angle(int32_t xvect, int32_t yvect)
{
fix16_t rv;
if ((xvect | yvect) == 0)
rv = 0;
else if (xvect == 0)
rv = fix16_from_int(512 + ((yvect < 0) << 10));
else if (yvect == 0)
rv = fix16_from_int(((xvect < 0) << 10));
else if (xvect == yvect)
rv = fix16_from_int(256 + ((xvect < 0) << 10));
else if (xvect == -yvect)
rv = fix16_from_int(768 + ((xvect > 0) << 10));
else if (klabs(xvect) > klabs(yvect))
rv = ((qradarang[5120 + scale(1280, yvect, xvect)] >> 6) + fix16_from_int(((xvect < 0) << 10))) & 0x7FFFFFF;
else rv = ((qradarang[5120 - scale(1280, xvect, yvect)] >> 6) + fix16_from_int(512 + ((yvect < 0) << 10))) & 0x7FFFFFF;
return rv;
}
//
// ksqrt
//
......
......@@ -4,7 +4,7 @@
/* Subtraction and addition with overflow detection.
* The versions without overflow detection are inlined in the header.
*/
fix16_t fix16_add(fix16_t a, fix16_t b)
FIXMATH_FUNC_ATTRS fix16_t fix16_add(fix16_t a, fix16_t b)
{
// Use unsigned integers because overflow with signed integers is
// an undefined operation (http://www.airs.com/blog/archives/120).
......@@ -19,7 +19,7 @@ fix16_t fix16_add(fix16_t a, fix16_t b)
return sum;
}
fix16_t fix16_sub(fix16_t a, fix16_t b)
FIXMATH_FUNC_ATTRS fix16_t fix16_sub(fix16_t a, fix16_t b)
{
uint32_t _a = a, _b = b;
uint32_t diff = _a - _b;
......@@ -33,7 +33,7 @@ fix16_t fix16_sub(fix16_t a, fix16_t b)
}
/* Saturating arithmetic */
fix16_t fix16_sadd(fix16_t a, fix16_t b)
FIXMATH_FUNC_ATTRS fix16_t fix16_sadd(fix16_t a, fix16_t b)
{
fix16_t result = fix16_add(a, b);
......@@ -43,7 +43,7 @@ fix16_t fix16_sadd(fix16_t a, fix16_t b)
return result;
}
fix16_t fix16_ssub(fix16_t a, fix16_t b)
FIXMATH_FUNC_ATTRS fix16_t fix16_ssub(fix16_t a, fix16_t b)
{
fix16_t result = fix16_sub(a, b);
......@@ -61,7 +61,7 @@ fix16_t fix16_ssub(fix16_t a, fix16_t b)
* detection.
*/
fix16_t fix16_mul(fix16_t inArg0, fix16_t inArg1)
FIXMATH_FUNC_ATTRS fix16_t fix16_mul(fix16_t inArg0, fix16_t inArg1)
{
int64_t product = (int64_t)inArg0 * inArg1;
......@@ -95,7 +95,7 @@ fix16_t fix16_mul(fix16_t inArg0, fix16_t inArg1)
}
/* Wrapper around fix16_mul to add saturating arithmetic. */
fix16_t fix16_smul(fix16_t inArg0, fix16_t inArg1)
FIXMATH_FUNC_ATTRS fix16_t fix16_smul(fix16_t inArg0, fix16_t inArg1)
{
fix16_t result = fix16_mul(inArg0, inArg1);
......@@ -128,7 +128,7 @@ static uint8_t clz(uint32_t x)
}
#endif
fix16_t fix16_div(fix16_t a, fix16_t b)
FIXMATH_FUNC_ATTRS fix16_t fix16_div(fix16_t a, fix16_t b)
{
// This uses a hardware 32/32 bit division multiple times, until we have
// computed all the bits in (a<<17)/b. Usually this takes 1-3 iterations.
......@@ -197,7 +197,7 @@ fix16_t fix16_div(fix16_t a, fix16_t b)
}
/* Wrapper around fix16_div to add saturating arithmetic. */
fix16_t fix16_sdiv(fix16_t inArg0, fix16_t inArg1)
FIXMATH_FUNC_ATTRS fix16_t fix16_sdiv(fix16_t inArg0, fix16_t inArg1)
{
fix16_t result = fix16_div(inArg0, inArg1);
......@@ -212,7 +212,7 @@ fix16_t fix16_sdiv(fix16_t inArg0, fix16_t inArg1)
return result;
}
fix16_t fix16_lerp8(fix16_t inArg0, fix16_t inArg1, uint8_t inFract)
FIXMATH_FUNC_ATTRS fix16_t fix16_lerp8(fix16_t inArg0, fix16_t inArg1, uint8_t inFract)
{
int64_t tempOut = int64_mul_i32_i32(inArg0, ((1 << 8) - inFract));
tempOut = int64_add(tempOut, int64_mul_i32_i32(inArg1, inFract));
......@@ -220,7 +220,7 @@ fix16_t fix16_lerp8(fix16_t inArg0, fix16_t inArg1, uint8_t inFract)
return (fix16_t)int64_lo(tempOut);
}
fix16_t fix16_lerp16(fix16_t inArg0, fix16_t inArg1, uint16_t inFract)
FIXMATH_FUNC_ATTRS fix16_t fix16_lerp16(fix16_t inArg0, fix16_t inArg1, uint16_t inFract)
{
int64_t tempOut = int64_mul_i32_i32(inArg0, (((int32_t)1 << 16) - inFract));
tempOut = int64_add(tempOut, int64_mul_i32_i32(inArg1, inFract));
......@@ -228,7 +228,7 @@ fix16_t fix16_lerp16(fix16_t inArg0, fix16_t inArg1, uint16_t inFract)
return (fix16_t)int64_lo(tempOut);
}
fix16_t fix16_lerp32(fix16_t inArg0, fix16_t inArg1, uint32_t inFract)
FIXMATH_FUNC_ATTRS fix16_t fix16_lerp32(fix16_t inArg0, fix16_t inArg1, uint32_t inFract)
{
int64_t tempOut;
tempOut = ((int64_t)inArg0 * (0 - inFract));
......
......@@ -13,7 +13,7 @@ GLenum BuildGLError;
void BuildGLErrorCheck(void)
{
volatile GLenum err;
while ((err = glGetError()) != GL_NO_ERROR)
while (err = glGetError(), err != GL_NO_ERROR)
{
BuildGLError = err; // set a watchpoint/breakpoint here
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment