From 8c7760a7467159c80c925b5133e6e6f9c8dded84 Mon Sep 17 00:00:00 2001 From: joonicks Date: Thu, 16 Sep 2021 16:00:50 +0200 Subject: [PATCH] typecasting --- src/SpaceStationType.cpp | 6 +++--- src/collider/GeomTree.cpp | 6 +++--- src/collider/Weld.h | 2 +- src/graphics/opengl/Program.cpp | 6 +++--- src/graphics/opengl/RendererGL.cpp | 4 ++-- src/graphics/opengl/Shader.h | 2 +- src/scenegraph/Serializer.h | 4 ++-- src/win32/TextUtils.cpp | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/SpaceStationType.cpp b/src/SpaceStationType.cpp index c3e80726a9a..cea956357cc 100644 --- a/src/SpaceStationType.cpp +++ b/src/SpaceStationType.cpp @@ -233,7 +233,7 @@ void SpaceStationType::OnSetupComplete() } #pragma message("FIX: warning of data loss (x64)") - numDockingPorts = 0xFFFFFFFF & m_portPaths.size(); + numDockingPorts = unsigned int(m_portPaths.size()); // sanity assert(!m_portPaths.empty()); @@ -423,11 +423,11 @@ const SpaceStationType *SpaceStationType::RandomStationType(Random &random, cons { if (bIsGround) { #pragma message("FIX: warning of data loss (x64)") - return &surfaceTypes[random.Int32(0xFFFFFFFF & SpaceStationType::surfaceTypes.size())]; + return &surfaceTypes[random.Int32(int(SpaceStationType::surfaceTypes.size()))]; } #pragma message("FIX: warning of data loss (x64)") - return &orbitalTypes[random.Int32(0xFFFFFFFF & SpaceStationType::orbitalTypes.size())]; + return &orbitalTypes[random.Int32(int(SpaceStationType::orbitalTypes.size()))]; } /*static*/ diff --git a/src/collider/GeomTree.cpp b/src/collider/GeomTree.cpp index b49311198dd..30db2377c0f 100644 --- a/src/collider/GeomTree.cpp +++ b/src/collider/GeomTree.cpp @@ -114,13 +114,13 @@ GeomTree::GeomTree(const int numVerts, const int numTris, const std::vector &p, std::vector &xrefs) { #pragma message("FIX: warning of data loss (x64)") - const Uint32 N = 0xFFFFFFFF & p.size(); // # of input vertices. + const Uint32 N = uint32_t(p.size()); // # of input vertices. Uint32 outputCount = 0; // # of output vertices Uint32 hashSize = nextPowerOfTwo(N); // size of the hash table Uint32 *hashTable = new Uint32[hashSize + N]; // hash table + linked list diff --git a/src/graphics/opengl/Program.cpp b/src/graphics/opengl/Program.cpp index 3c472c76073..f5b2e8dd9a2 100644 --- a/src/graphics/opengl/Program.cpp +++ b/src/graphics/opengl/Program.cpp @@ -185,21 +185,21 @@ namespace Graphics { { blocks.push_back(str); #pragma message("FIX: warning of data loss (x64)") - block_sizes.push_back(0xFFFFFFFF & std::strlen(str)); + block_sizes.push_back(int(std::strlen(str))); } void AppendSource(StringRange str) { blocks.push_back(str.begin); #pragma message("FIX: warning of data loss (x64)") - block_sizes.push_back(0xFFFFFFFF & str.Size()); + block_sizes.push_back(int(str.Size())); } void Compile(GLuint shader_id) { assert(blocks.size() == block_sizes.size()); #pragma message("FIX: warning of data loss (x64)") - glShaderSource(shader_id, 0xFFFFFFFF & blocks.size(), &blocks[0], &block_sizes[0]); + glShaderSource(shader_id, GLsizei(blocks.size()), &blocks[0], &block_sizes[0]); glCompileShader(shader_id); } diff --git a/src/graphics/opengl/RendererGL.cpp b/src/graphics/opengl/RendererGL.cpp index 3600824050a..6087878167c 100644 --- a/src/graphics/opengl/RendererGL.cpp +++ b/src/graphics/opengl/RendererGL.cpp @@ -542,7 +542,7 @@ namespace Graphics { } #pragma message("FIX: warning of data loss (x64)") - stat.SetStatCount(Stats::STAT_DYNAMIC_DRAW_BUFFER_INUSE, 0xFFFFFFFF & s_DynamicDrawBufferMap.size()); + stat.SetStatCount(Stats::STAT_DYNAMIC_DRAW_BUFFER_INUSE, uint32_t(s_DynamicDrawBufferMap.size())); stat.SetStatCount(Stats::STAT_DRAW_UNIFORM_BUFFER_INUSE, uint32_t(m_drawUniformBuffers.size())); stat.SetStatCount(Stats::STAT_DRAW_UNIFORM_BUFFER_ALLOCS, numAllocs); @@ -551,7 +551,7 @@ namespace Graphics { numShaderPrograms += pair.second->GetNumVariants(); #pragma message("FIX: warning of data loss (x64)") - stat.SetStatCount(Stats::STAT_NUM_RENDER_STATES, 0xFFFFFFFF & m_renderStateCache->m_stateDescCache.size()); + stat.SetStatCount(Stats::STAT_NUM_RENDER_STATES, uint32_t(m_renderStateCache->m_stateDescCache.size())); stat.SetStatCount(Stats::STAT_NUM_SHADER_PROGRAMS, numShaderPrograms); return true; diff --git a/src/graphics/opengl/Shader.h b/src/graphics/opengl/Shader.h index a8241ba3633..954643527e4 100644 --- a/src/graphics/opengl/Shader.h +++ b/src/graphics/opengl/Shader.h @@ -78,7 +78,7 @@ namespace Graphics { #pragma message("FIX: warning of data loss (x64)") uint32_t GetNumVariants() const { - return 0xFFFFFFFF & m_variants.size(); + return uint32_t(m_variants.size()); } TextureBindingData GetTextureBindingInfo(size_t name) const; diff --git a/src/scenegraph/Serializer.h b/src/scenegraph/Serializer.h index be827c73560..8876827de2f 100644 --- a/src/scenegraph/Serializer.h +++ b/src/scenegraph/Serializer.h @@ -46,7 +46,7 @@ namespace Serializer { void writeObject(const std::string &obj) { #pragma message("FIX: warning of data loss (x64)") - writeObject(0xFFFFFFFF & obj.size()); + writeObject(uint32_t(obj.size())); m_str.append(obj.c_str(), obj.size()); } @@ -83,7 +83,7 @@ namespace Serializer { { assert(range.Size() < SDL_MAX_UINT32); #pragma message("FIX: warning of data loss (x64)") - Int32(0xFFFFFFFF & range.Size()); + Int32(uint32_t(range.Size())); if (range.Size()) { m_str.append(range.begin, range.Size()); } diff --git a/src/win32/TextUtils.cpp b/src/win32/TextUtils.cpp index 21dc5c384fd..2eb9db7cad4 100644 --- a/src/win32/TextUtils.cpp +++ b/src/win32/TextUtils.cpp @@ -13,7 +13,7 @@ std::wstring transcode_utf8_to_utf16(const char *s, size_t nbytes) { std::wstring buf(nbytes, L'x'); #pragma message("FIX: warning of data loss (x64)") - int reqchars = MultiByteToWideChar(CP_UTF8, 0, s, 0xFFFFFFFF & nbytes, &buf[0], 0xFFFFFFFF & buf.size()); + int reqchars = MultiByteToWideChar(CP_UTF8, 0, s, int(nbytes), &buf[0], int(buf.size())); if (!reqchars) { fprintf(stderr, "failed to transcode UTF-8 to UTF-16\n"); abort(); @@ -31,7 +31,7 @@ std::string transcode_utf16_to_utf8(const wchar_t *s, size_t nchars) { std::string buf(nchars * 2, 'x'); #pragma message("FIX: warning of data loss (x64)") - int reqbytes = WideCharToMultiByte(CP_UTF8, 0, s, 0xFFFFFFFF & nchars, &buf[0], 0xFFFFFFFF & buf.size(), 0, 0); + int reqbytes = WideCharToMultiByte(CP_UTF8, 0, s, int(nchars), &buf[0], int(buf.size()), 0, 0); if (!reqbytes) { fprintf(stderr, "failed to transcode UTF-16 to UTF-8\n"); abort();