mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Rename the implementation of _lrotl() found at the top of kplib.cpp to klrotl() and use it unconditionally on platforms other than Win32 (it's only used in .bmp rendering).
git-svn-id: https://svn.eduke32.com/eduke32@7145 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
7f54981f4f
commit
786a0cc6a3
1 changed files with 16 additions and 15 deletions
|
@ -35,22 +35,23 @@ credits.
|
||||||
#include "pragmas.h"
|
#include "pragmas.h"
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#include <dirent.h>
|
# include <dirent.h>
|
||||||
static inline int32_t _lrotl(int32_t i, int sh) { return (i >> (-sh)) | (i << sh); }
|
static FORCE_INLINE CONSTEXPR int32_t klrotl(int32_t i, int sh) { return (i >> (-sh)) | (i << sh); }
|
||||||
/*inline*/ int32_t filelength(int h)
|
/*inline*/ int32_t filelength(int h)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(h,&st) < 0) return -1;
|
if (fstat(h,&st) < 0) return -1;
|
||||||
return st.st_size;
|
return st.st_size;
|
||||||
}
|
}
|
||||||
#define _fileno fileno
|
# define _fileno fileno
|
||||||
#else
|
#else
|
||||||
#include <io.h>
|
# define klrotl(i, sh) _lrotl(i, sh)
|
||||||
#ifdef __clang__
|
# include <io.h>
|
||||||
#include <emmintrin.h>
|
# ifdef __clang__
|
||||||
#else
|
# include <emmintrin.h>
|
||||||
#include <intrin.h>
|
# else
|
||||||
#endif
|
# include <intrin.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//use GCC-specific extension to force symbol name to be something in particular to override underscoring.
|
//use GCC-specific extension to force symbol name to be something in particular to override underscoring.
|
||||||
|
@ -1980,17 +1981,17 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
|
||||||
case 16: for (x=x0; x<x1; x++)
|
case 16: for (x=x0; x<x1; x++)
|
||||||
{
|
{
|
||||||
i = ((int32_t)(B_UNBUF16(&cptr[x<<1])));
|
i = ((int32_t)(B_UNBUF16(&cptr[x<<1])));
|
||||||
lptr[x] = (_lrotl(i,palcol[0])&palcol[3]) +
|
lptr[x] = (klrotl(i,palcol[0])&palcol[3]) +
|
||||||
(_lrotl(i,palcol[1])&palcol[4]) +
|
(klrotl(i,palcol[1])&palcol[4]) +
|
||||||
(_lrotl(i,palcol[2])&palcol[5]) + B_LITTLE32(0xff000000);
|
(klrotl(i,palcol[2])&palcol[5]) + B_LITTLE32(0xff000000);
|
||||||
} break;
|
} break;
|
||||||
case 24: for (x=x0; x<x1; x++) lptr[x] = ((B_UNBUF32(&cptr[x*3]))|B_LITTLE32(0xff000000)); break;
|
case 24: for (x=x0; x<x1; x++) lptr[x] = ((B_UNBUF32(&cptr[x*3]))|B_LITTLE32(0xff000000)); break;
|
||||||
case 32: for (x=x0; x<x1; x++)
|
case 32: for (x=x0; x<x1; x++)
|
||||||
{
|
{
|
||||||
i = (B_UNBUF32(&cptr[x<<2]));
|
i = (B_UNBUF32(&cptr[x<<2]));
|
||||||
lptr[x] = (_lrotl(i,palcol[0])&palcol[3]) +
|
lptr[x] = (klrotl(i,palcol[0])&palcol[3]) +
|
||||||
(_lrotl(i,palcol[1])&palcol[4]) +
|
(klrotl(i,palcol[1])&palcol[4]) +
|
||||||
(_lrotl(i,palcol[2])&palcol[5]) + B_LITTLE32(0xff000000);
|
(klrotl(i,palcol[2])&palcol[5]) + B_LITTLE32(0xff000000);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue