if 0 out our klabs() function and just define it as abs()

The compiler generates much better code for this now.

git-svn-id: https://svn.eduke32.com/eduke32@7863 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-08-01 06:50:13 +00:00 committed by Christoph Oelckers
parent 752cf77887
commit 26272f6755
1 changed files with 6 additions and 2 deletions

View File

@ -241,11 +241,15 @@ static FORCE_INLINE CONSTEXPR char readpixel(void *s) { return *(char *)s; }
static FORCE_INLINE void drawpixel(void *s, char a) { *(char *)s = a; }
#ifndef pragmas_have_klabs
static FORCE_INLINE int32_t klabs(int32_t a)
#if 0
static FORCE_INLINE int32_t klabs(int32_t const a)
{
const uint32_t m = a >> (sizeof(uint32_t) * CHAR_BIT - 1);
uint32_t const m = a >> (sizeof(uint32_t) * CHAR_BIT - 1);
return (a ^ m) - m;
}
#else
#define klabs(x) abs(x)
#endif
#endif
#ifndef pragmas_have_ksgn
static FORCE_INLINE CONSTEXPR int32_t ksgn(int32_t a) { return (a > 0) - (a < 0); }