Skip to content

Commit

Permalink
Mark instruction helpers appropriate as constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Oct 1, 2020
1 parent 8c4315f commit 13c7421
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/fizzy/execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ inline T load(bytes_view input, size_t offset) noexcept
}

template <typename DstT, typename SrcT>
inline DstT extend(SrcT in) noexcept
inline constexpr DstT extend(SrcT in) noexcept
{
if constexpr (std::is_same_v<SrcT, DstT>)
return in;
Expand Down Expand Up @@ -176,7 +176,7 @@ inline bool load_from_memory(
}

template <typename DstT>
inline DstT shrink(Value value) noexcept
inline constexpr DstT shrink(Value value) noexcept
{
if constexpr (std::is_floating_point_v<DstT>)
return value.as<DstT>();
Expand Down Expand Up @@ -262,7 +262,7 @@ inline constexpr T rem(T a, T b) noexcept
}

template <typename T>
inline T shift_left(T lhs, T rhs) noexcept
inline constexpr T shift_left(T lhs, T rhs) noexcept
{
static_assert(std::is_integral_v<T>);

Expand All @@ -272,7 +272,7 @@ inline T shift_left(T lhs, T rhs) noexcept
}

template <typename T>
inline T shift_right(T lhs, T rhs) noexcept
inline constexpr T shift_right(T lhs, T rhs) noexcept
{
static_assert(std::is_integral_v<T>);

Expand All @@ -282,7 +282,7 @@ inline T shift_right(T lhs, T rhs) noexcept
}

template <typename T>
inline T rotl(T lhs, T rhs) noexcept
inline constexpr T rotl(T lhs, T rhs) noexcept
{
static_assert(std::is_integral_v<T>);

Expand All @@ -296,7 +296,7 @@ inline T rotl(T lhs, T rhs) noexcept
}

template <typename T>
inline T rotr(T lhs, T rhs) noexcept
inline constexpr T rotr(T lhs, T rhs) noexcept
{
static_assert(std::is_integral_v<T>);

Expand Down Expand Up @@ -423,7 +423,7 @@ __attribute__((no_sanitize("float-divide-by-zero"))) inline constexpr T fdiv(T a
}

template <typename T>
inline constexpr T fmin(T a, T b) noexcept
inline T fmin(T a, T b) noexcept
{
static_assert(std::is_floating_point_v<T>);

Expand All @@ -437,7 +437,7 @@ inline constexpr T fmin(T a, T b) noexcept
}

template <typename T>
inline constexpr T fmax(T a, T b) noexcept
inline T fmax(T a, T b) noexcept
{
static_assert(std::is_floating_point_v<T>);

Expand Down

0 comments on commit 13c7421

Please sign in to comment.