Fix warnings with Apple clang++
* Unused private member
* Overflow error when subtracting num_fraction_bits for HF16 and HF
diff --git a/include/util/hex_float.h b/include/util/hex_float.h
index 6f4b7c0..419d908 100644
--- a/include/util/hex_float.h
+++ b/include/util/hex_float.h
@@ -483,7 +483,7 @@
// rounding rules.
switch (dir) {
case round_direction::kToZero:
- break;
+ break;
case round_direction::kToPositiveInfinity:
round_away_from_zero = !isNegative();
break;
@@ -493,7 +493,7 @@
case round_direction::kToNearestEven:
// Have to round down, round bit is 0
if ((first_rounded_bit & significand) == 0) {
- break;
+ break;
}
if (((significand & throwaway_mask) & ~first_rounded_bit) != 0) {
// If any subsequent bit of the rounded portion is non-0 then we round
@@ -573,8 +573,9 @@
if (is_nan) {
typename other_T::uint_type shifted_significand;
shifted_significand = static_cast<typename other_T::uint_type>(
- negatable_left_shift<other_T::num_fraction_bits -
- num_fraction_bits>::val(significand));
+ negatable_left_shift<static_cast<int_type>(other_T::num_fraction_bits) -
+ static_cast<int_type>(
+ num_fraction_bits)>::val(significand));
// We are some sort of Nan. We try to keep the bit-pattern of the Nan
// as close as possible. If we had to shift off bits so we are 0, then we
diff --git a/source/disassemble.cpp b/source/disassemble.cpp
index 1a7c939..292caa0 100644
--- a/source/disassemble.cpp
+++ b/source/disassemble.cpp
@@ -48,10 +48,9 @@
// representation.
class Disassembler {
public:
- Disassembler(const libspirv::AssemblyGrammar& grammar, uint32_t const* words,
+ Disassembler(const libspirv::AssemblyGrammar& grammar,
uint32_t options)
- : words_(words),
- grammar_(grammar),
+ : grammar_(grammar),
print_(spvIsInBitfield(SPV_BINARY_TO_TEXT_OPTION_PRINT, options)),
color_(print_ &&
spvIsInBitfield(SPV_BINARY_TO_TEXT_OPTION_COLOR, options)),
@@ -113,9 +112,6 @@
if (color_) out_.get() << libspirv::clr::green();
}
- // The SPIR-V binary. The endianness is not necessarily converted
- // to native endianness.
- const uint32_t* const words_;
const libspirv::AssemblyGrammar& grammar_;
const bool print_; // Should we also print to the standard output stream?
const bool color_; // Should we print in colour?
@@ -394,7 +390,7 @@
const libspirv::AssemblyGrammar grammar(context);
if (!grammar.isValid()) return SPV_ERROR_INVALID_TABLE;
- Disassembler disassembler(grammar, code, options);
+ Disassembler disassembler(grammar, options);
if (auto error = spvBinaryParse(context, &disassembler, code, wordCount,
DisassembleHeader, DisassembleInstruction,
pDiagnostic)) {