52 lines
1.4 KiB
Diff
52 lines
1.4 KiB
Diff
From ac07dac1782544b61e44b9fe1d5f0fffd356aa15 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= <ricolvs123@gmail.com>
|
|
Date: Sun, 4 Dec 2022 17:10:09 -0300
|
|
Subject: [PATCH 01/51] Add casts to F32 Map/MapIterator functions to get rid
|
|
of double to float conversion warnings
|
|
|
|
---
|
|
src/common/scripting/core/maps.cpp | 20 ++++++++++++++++++--
|
|
1 file changed, 18 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/common/scripting/core/maps.cpp b/src/common/scripting/core/maps.cpp
|
|
index bb7cd369b..28fda643e 100644
|
|
--- a/src/common/scripting/core/maps.cpp
|
|
+++ b/src/common/scripting/core/maps.cpp
|
|
@@ -162,7 +162,15 @@ template<typename M> void MapInsert(M * self, expand_types_vm<typename M::KeyTyp
|
|
MAP_GC_WRITE_BARRIER(self);
|
|
GC::WriteBarrier(value);
|
|
}
|
|
- self->Insert(key, value);
|
|
+
|
|
+ if constexpr(std::is_same_v<typename M::ValueType, float>)
|
|
+ {
|
|
+ self->Insert(key,static_cast<float>(value));
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ self->Insert(key, value);
|
|
+ }
|
|
self->info->rev++; // invalidate iterators
|
|
}
|
|
|
|
@@ -246,7 +254,15 @@ template<typename I> void MapIteratorSetValue(I * self, expand_types_vm<typename
|
|
GC::WriteBarrier(val);
|
|
GC::WriteBarrier(value);
|
|
}
|
|
- val = value;
|
|
+
|
|
+ if constexpr(std::is_same_v<typename I::ValueType, float>)
|
|
+ {
|
|
+ val = static_cast<float>(value);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ val = value;
|
|
+ }
|
|
}
|
|
|
|
|
|
--
|
|
2.39.3
|
|
|