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) #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;
@ -45,6 +45,7 @@ static inline int32_t _lrotl(int32_t i, int sh) { return (i >> (-sh)) | (i << sh
} }
# define _fileno fileno # define _fileno fileno
#else #else
# define klrotl(i, sh) _lrotl(i, sh)
# include <io.h> # include <io.h>
# ifdef __clang__ # ifdef __clang__
# include <emmintrin.h> # 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++) 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;
} }