<< diagnostic->error << "\n";
return SPV_SUCCESS;
}
-
- return SPV_ERROR_INVALID_VALUE;
}
namespace libspirv {
spv_operand_pattern_t* pattern) {
// Scan from highest bits to lowest bits because we will prepend in LIFO
// fashion, and we need the operands for lower order bits to appear first.
- for (uint32_t candidate_bit = (1 << 31); candidate_bit; candidate_bit >>= 1) {
+ for (uint32_t candidate_bit = (1u << 31u); candidate_bit; candidate_bit >>= 1) {
if (candidate_bit & mask) {
spv_operand_desc entry = nullptr;
if (SPV_SUCCESS == spvOperandTableValueLookup(operandTable, type,
default:
return false;
}
- return false;
}
// If we are up-casting, then we just have to shift to the right location.
if (num_throwaway_bits <= 0) {
out_val = static_cast<other_uint_type>(significand);
- uint_type shift_amount = -num_throwaway_bits;
+ uint_type shift_amount = static_cast<uint_type>(-num_throwaway_bits);
out_val = static_cast<other_uint_type>(out_val << shift_amount);
return out_val;
}
return static_cast<other_uint_type>(
negatable_right_shift<num_throwaway_bits>::val(significand));
}
- // We really shouldn't get here.
- assert(false && "We should not have ended up here");
- return 0;
}
// Casts this value to another HexFloat. If the cast is widening,
bool aboveZero(const std::vector<uint32_t>& constWords,
const std::vector<uint32_t>& typeWords) {
const uint32_t width = typeWords[2];
- const bool is_signed = typeWords[3];
+ const bool is_signed = typeWords[3] > 0;
const uint32_t loWord = constWords[3];
if (width > 32) {
// The spec currently doesn't allow integers wider than 64 bits.
const uint32_t hiWord = constWords[4]; // Must exist, per spec.
if (is_signed && (hiWord >> 31)) return false;
- return loWord | hiWord;
+ return (loWord | hiWord) > 0;
} else {
if (is_signed && (loWord >> 31)) return false;
return loWord > 0;
}
bool ValidationState_t::hasCapability(SpvCapability cap) const {
- return module_capabilities_ & SPV_CAPABILITY_AS_MASK(cap);
+ return (module_capabilities_ & SPV_CAPABILITY_AS_MASK(cap)) != 0;
}
bool ValidationState_t::HasAnyOf(spv_capability_mask_t capabilities) const {