math/fp: add shift operators
This commit is contained in:
parent
c17ccd3f64
commit
db3729992e
12
math/fp.hpp
12
math/fp.hpp
@ -89,6 +89,18 @@ constexpr inline fp<T, I, B> operator+(const fp<T, I, B>& a, const fp<T, I, B>&
|
|||||||
return fp<T, I, B>(a.value + b.value, fp_raw_tag{});
|
return fp<T, I, B>(a.value + b.value, fp_raw_tag{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, typename I, int B>
|
||||||
|
constexpr inline fp<T, I, B> operator>>(const fp<T, I, B>& a, int s)
|
||||||
|
{
|
||||||
|
return fp<T, I, B>(a.value >> s, fp_raw_tag{});
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename I, int B>
|
||||||
|
constexpr inline fp<T, I, B> operator<<(const fp<T, I, B>& a, int s)
|
||||||
|
{
|
||||||
|
return fp<T, I, B>(a.value << s, fp_raw_tag{});
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, typename I, int B>
|
template <typename T, typename I, int B>
|
||||||
constexpr inline fp<T, I, B> operator-(const fp<T, I, B>& a, const fp<T, I, B>& b)
|
constexpr inline fp<T, I, B> operator-(const fp<T, I, B>& a, const fp<T, I, B>& b)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user