Files
MapLibreParticleLab/include/mbgl/util/bitmask_operations.hpp
Bart Louwers c79b6dcf52 Add end-of-file-fixer pre-commit hook (#3176)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-24 20:43:50 +01:00

33 lines
890 B
C++

#pragma once
#include <mbgl/util/traits.hpp>
#include <mbgl/util/util.hpp>
namespace mbgl {
template <typename Enum>
constexpr Enum operator|(Enum a, Enum b) {
static_assert(std::is_enum_v<Enum>, "Enum must be an enum type");
return Enum(mbgl::underlying_type(a) | mbgl::underlying_type(b));
}
template <typename Enum>
constexpr Enum& operator|=(Enum& a, Enum b) {
static_assert(std::is_enum_v<Enum>, "Enum must be an enum type");
return (a = a | b);
}
template <typename Enum>
constexpr bool operator&(Enum a, Enum b) {
static_assert(std::is_enum_v<Enum>, "Enum must be an enum type");
return bool(mbgl::underlying_type(a) & mbgl::underlying_type(b));
}
template <typename Enum>
constexpr Enum operator~(Enum value) {
static_assert(std::is_enum_v<Enum>, "Enum must be an enum type");
return Enum(~mbgl::underlying_type(value));
}
} // namespace mbgl