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:
terminx 2018-11-18 18:05:20 +00:00
parent 7f54981f4f
commit 786a0cc6a3

View file

@ -36,7 +36,7 @@ credits.
#if !defined(_WIN32)
# 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)
{
struct stat st;
@ -45,6 +45,7 @@ static inline int32_t _lrotl(int32_t i, int sh) { return (i >> (-sh)) | (i << sh
}
# define _fileno fileno
#else
# define klrotl(i, sh) _lrotl(i, sh)
# include <io.h>
# ifdef __clang__
# include <emmintrin.h>
@ -1980,17 +1981,17 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
case 16: for (x=x0; x<x1; x++)
{
i = ((int32_t)(B_UNBUF16(&cptr[x<<1])));
lptr[x] = (_lrotl(i,palcol[0])&palcol[3]) +
(_lrotl(i,palcol[1])&palcol[4]) +
(_lrotl(i,palcol[2])&palcol[5]) + B_LITTLE32(0xff000000);
lptr[x] = (klrotl(i,palcol[0])&palcol[3]) +
(klrotl(i,palcol[1])&palcol[4]) +
(klrotl(i,palcol[2])&palcol[5]) + 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++)
{
i = (B_UNBUF32(&cptr[x<<2]));
lptr[x] = (_lrotl(i,palcol[0])&palcol[3]) +
(_lrotl(i,palcol[1])&palcol[4]) +
(_lrotl(i,palcol[2])&palcol[5]) + B_LITTLE32(0xff000000);
lptr[x] = (klrotl(i,palcol[0])&palcol[3]) +
(klrotl(i,palcol[1])&palcol[4]) +
(klrotl(i,palcol[2])&palcol[5]) + B_LITTLE32(0xff000000);
} break;
}