Fix GCC and Release warnings

This commit is contained in:
Ashley Rogers 2025-03-20 14:30:41 -04:00
parent fd5cdd0cc4
commit a7ee344739
2 changed files with 14 additions and 8 deletions

View File

@ -242,13 +242,17 @@ struct IndicesForFaceFromAccessor {
if (primitiveMode == MeshPrimitive::Mode::TRIANGLE_FAN) {
result[0] = value[0];
result[1] = firstIndex < value.size() ? value[firstIndex] : -1;
result[2] = firstIndex + 1 < value.size() ? value[firstIndex + 1] : -1;
result[1] = firstIndex < value.size()
? static_cast<int64_t>(value[firstIndex])
: -1;
result[2] = firstIndex + 1 < value.size()
? static_cast<int64_t>(value[firstIndex + 1])
: -1;
} else {
for (int64_t i = 0; i < 3; i++) {
int64_t index = firstIndex + i;
result[static_cast<size_t>(i)] =
index < value.size() ? value[index] : -1;
index < value.size() ? static_cast<int64_t>(value[index]) : -1;
}
}

View File

@ -128,15 +128,16 @@ template <typename ElementType>
ElementType assembleVecNValue(const std::span<uint8_t> bytes) noexcept {
ElementType result = ElementType();
const glm::length_t N = TypeToDimensions<ElementType>::dimensions;
constexpr glm::length_t N = TypeToDimensions<ElementType>::dimensions;
using T = typename ElementType::value_type;
CESIUM_ASSERT(
sizeof(T) <= 2 && "Components cannot be larger than two bytes in size.");
if constexpr (std::is_same_v<T, int16_t>) {
CESIUM_ASSERT(
N == 2 && "Only vec2s can contain two-byte integer components.");
static_assert(
N == 2,
"Only vec2s can contain two-byte integer components.");
uint16_t x = static_cast<uint16_t>(bytes[0]) |
static_cast<uint16_t>(static_cast<uint16_t>(bytes[1]) << 8);
uint16_t y = static_cast<uint16_t>(bytes[2]) |
@ -147,8 +148,9 @@ ElementType assembleVecNValue(const std::span<uint8_t> bytes) noexcept {
}
if constexpr (std::is_same_v<T, uint16_t>) {
CESIUM_ASSERT(
N == 2 && "Only vec2s can contain two-byte integer components.");
static_assert(
N == 2,
"Only vec2s can contain two-byte integer components.");
result[0] = static_cast<uint16_t>(bytes[0]) |
static_cast<uint16_t>(static_cast<uint16_t>(bytes[1]) << 8);
result[1] = static_cast<uint16_t>(bytes[2]) |