Eliminate kCapabilitiesMin/Max.

This commit is contained in:
Dejan Mircevski 2016-04-22 14:05:55 -04:00
parent 59436bb6b7
commit a9f36d0143

View File

@ -45,19 +45,12 @@ typedef uint64_t spv_capability_mask_t;
#define SPV_CAPABILITY_AS_MASK(capability) \
(spv_capability_mask_t(1) << (capability))
// Min/max capability IDs. TODO(dekimir): move this into context.
enum {
kCapabilitiesMinValue = SpvCapabilityMatrix,
kCapabilitiesMaxValue = SpvCapabilityPipeStorage
};
// Applies f to every capability present in a mask.
namespace libspirv {
template <typename Functor>
inline void ForEach(spv_capability_mask_t capabilities, Functor f) {
for (int cap = kCapabilitiesMinValue; cap <= kCapabilitiesMaxValue; ++cap)
if (spvIsInBitfield(SPV_CAPABILITY_AS_MASK(cap), capabilities))
f(static_cast<SpvCapability>(cap));
for (int c = 0; capabilities; ++c, capabilities >>= 1)
if (capabilities & 1) f(static_cast<SpvCapability>(c));
}
} // end namespace libspirv