Commit 48f3f6cb by David 'Digit' Turner Committed by Ben Clayton

Remove two minor compiler warnings/errors:

Found when building with the Fuchsia toolchain, which uses a recent clang version: - The constants '1.0f / 0x7FFFFFFF' and '1.0f / 0xFFFFFFFF' cannot be computed directly without losing one bit of accuracy, and the compiler was complaining about it, so use intermediate double values to get the correct, final result. - The MemoryMapped class needs to be declared final to have a final destructor, otherwise the compiler complains with: error: class with destructor marked 'final' cannot be inherited from [-Werror,-Wfinal-dtor-non-final-class] Bug: None Change-Id: I9728df87fd5d12418ef7d73aa651eca02b0e36f9 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42888 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 02e15b24
...@@ -341,8 +341,12 @@ Constants::Constants() ...@@ -341,8 +341,12 @@ Constants::Constants()
static const float4 unscaleSByte = { 1.0f / 0x7F, 1.0f / 0x7F, 1.0f / 0x7F, 1.0f / 0x7F }; static const float4 unscaleSByte = { 1.0f / 0x7F, 1.0f / 0x7F, 1.0f / 0x7F, 1.0f / 0x7F };
static const float4 unscaleShort = { 1.0f / 0x7FFF, 1.0f / 0x7FFF, 1.0f / 0x7FFF, 1.0f / 0x7FFF }; static const float4 unscaleShort = { 1.0f / 0x7FFF, 1.0f / 0x7FFF, 1.0f / 0x7FFF, 1.0f / 0x7FFF };
static const float4 unscaleUShort = { 1.0f / 0xFFFF, 1.0f / 0xFFFF, 1.0f / 0xFFFF, 1.0f / 0xFFFF }; static const float4 unscaleUShort = { 1.0f / 0xFFFF, 1.0f / 0xFFFF, 1.0f / 0xFFFF, 1.0f / 0xFFFF };
static const float4 unscaleInt = { 1.0f / 0x7FFFFFFF, 1.0f / 0x7FFFFFFF, 1.0f / 0x7FFFFFFF, 1.0f / 0x7FFFFFFF };
static const float4 unscaleUInt = { 1.0f / 0xFFFFFFFF, 1.0f / 0xFFFFFFFF, 1.0f / 0xFFFFFFFF, 1.0f / 0xFFFFFFFF }; // NOTE: Using "1.0f / 0x7FFFFFF" below results in a compiler error, e.g.:
// error: implicit conversion from 'int' to 'float' changes value from 2147483646 to 2147483648
static const float4 unscaleInt = { (float)(1.0 / 0x7FFFFFFF), (float)(1.0 / 0x7FFFFFFF), (float)(1.0 / 0x7FFFFFFF), (float)(1.0 / 0x7FFFFFFF) };
static const float4 unscaleUInt = { (float)(1.0 / 0xFFFFFFFF), (float)(1.0 / 0xFFFFFFFF), (float)(1.0 / 0xFFFFFFFF), (float)(1.0 / 0xFFFFFFFF) };
static const float4 unscaleFixed = { 1.0f / 0x00010000, 1.0f / 0x00010000, 1.0f / 0x00010000, 1.0f / 0x00010000 }; static const float4 unscaleFixed = { 1.0f / 0x00010000, 1.0f / 0x00010000, 1.0f / 0x00010000, 1.0f / 0x00010000 };
memcpy(&this->unscaleByte, &unscaleByte, sizeof(unscaleByte)); memcpy(&this->unscaleByte, &unscaleByte, sizeof(unscaleByte));
......
...@@ -271,7 +271,7 @@ JITGlobals::JITGlobals(const char *mcpu, ...@@ -271,7 +271,7 @@ JITGlobals::JITGlobals(const char *mcpu,
{ {
} }
class MemoryMapper : public llvm::SectionMemoryManager::MemoryMapper class MemoryMapper final : public llvm::SectionMemoryManager::MemoryMapper
{ {
public: public:
MemoryMapper() {} MemoryMapper() {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment