diff --git a/source/build/include/build.h b/source/build/include/build.h index bf5f1f8eb..bcb87ca7d 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -792,8 +792,20 @@ EXTERN vec2s_t tilesiz[MAXTILES]; EXTERN char picsiz[MAXTILES]; EXTERN char walock[MAXTILES]; -extern const char pow2char[8]; -extern const int32_t pow2long[32]; + +extern const char pow2char_[]; +static CONSTEXPR const char pow2char[8] = {1,2,4,8,16,32,64,128}; +static CONSTEXPR const int32_t pow2long[32] = +{ + 1, 2, 4, 8, + 16, 32, 64, 128, + 256, 512, 1024, 2048, + 4096, 8192, 16384, 32768, + 65536, 131072, 262144, 524288, + 1048576, 2097152, 4194304, 8388608, + 16777216, 33554432, 67108864, 134217728, + 268435456, 536870912, 1073741824, 2147483647 +}; // picanm[].sf: // |bit(1<<7) diff --git a/source/build/src/a.masm b/source/build/src/a.masm index 48592ae3e..3ad02c0ee 100644 --- a/source/build/src/a.masm +++ b/source/build/src/a.masm @@ -40,9 +40,6 @@ EXTRN _bufplce : near EXTRN _ebpbak : dword EXTRN _espbak : dword -EXTRN _pow2char : near -EXTRN _pow2long : near - EXTRN _globaltilesizy : dword ; Some macros to help make cdecl calling easier to manage diff --git a/source/build/src/a.nasm b/source/build/src/a.nasm index ee573fc95..35a305909 100644 --- a/source/build/src/a.nasm +++ b/source/build/src/a.nasm @@ -50,8 +50,6 @@ SECTION .text %define bufplce _bufplce %define ebpbak _ebpbak %define espbak _espbak -%define pow2char _pow2char -%define pow2long _pow2long %define globaltilesizy _globaltilesizy %define sethlinesizes _sethlinesizes @@ -202,9 +200,6 @@ SECTION .text EXTERN ebpbak EXTERN espbak - EXTERN pow2char - EXTERN pow2long - EXTERN globaltilesizy GLOBAL sethlinesizes diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 260609f49..005053b48 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -168,20 +168,9 @@ static intptr_t slopalookup[16384]; // was 2048 static int32_t no_radarang2 = 0; static int16_t radarang[1280], *radarang2; +const char ATTRIBUTE((used)) pow2char_[8] = {1,2,4,8,16,32,64,128}; uint16_t ATTRIBUTE((used)) sqrtable[4096], ATTRIBUTE((used)) shlookup[4096+256]; -const char pow2char[8] = {1,2,4,8,16,32,64,128}; -const int32_t pow2long[32] = -{ - 1, 2, 4, 8, - 16, 32, 64, 128, - 256, 512, 1024, 2048, - 4096, 8192, 16384, 32768, - 65536, 131072, 262144, 524288, - 1048576, 2097152, 4194304, 8388608, - 16777216, 33554432, 67108864, 134217728, - 268435456, 536870912, 1073741824, 2147483647 -}; char britable[16][256]; // JBF 20040207: full 8bit precision diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index 9536f215c..735cd65f1 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -362,7 +362,7 @@ skipit: "shrl $3, %%eax\n\t" \ "andl $7, %%ebx\n\t" \ "movb " ASMSYM("gotpic") "(%%eax), %%dl\n\t" \ - "movb " ASMSYM("pow2char") "(%%ebx), %%bl\n\t" \ + "movb " ASMSYM("pow2char_") "(%%ebx), %%bl\n\t" \ "orb %%bl, %%dl\n\t" \ "movb %%dl, " ASMSYM("gotpic") "(%%eax)" \ : "=a" (__a) : "a" (__a) \ diff --git a/source/build/src/kplib.cpp b/source/build/src/kplib.cpp index 6fdc70aa4..5ec453d7d 100644 --- a/source/build/src/kplib.cpp +++ b/source/build/src/kplib.cpp @@ -64,7 +64,7 @@ static FORCE_INLINE CONSTEXPR int32_t klrotl(int32_t i, int sh) { return (i >> ( static intptr_t kp_frameplace; static int32_t kp_bytesperline, kp_xres, kp_yres; -static const int32_t pow2mask[32] = +static CONSTEXPR const int32_t pow2mask[32] = { 0x00000000,0x00000001,0x00000003,0x00000007, 0x0000000f,0x0000001f,0x0000003f,0x0000007f, @@ -75,7 +75,7 @@ static const int32_t pow2mask[32] = 0x00ffffff,0x01ffffff,0x03ffffff,0x07ffffff, 0x0fffffff,0x1fffffff,0x3fffffff,0x7fffffff, }; -static const int32_t pow2long[32] = +static CONSTEXPR const int32_t pow2long[32] = { 0x00000001,0x00000002,0x00000004,0x00000008, 0x00000010,0x00000020,0x00000040,0x00000080,