build: fix warnings from -Wparentheses
This commit is contained in:
parent
5642ff43b8
commit
4f10505d09
@ -39,7 +39,7 @@ namespace util {
|
|||||||
constexpr T
|
constexpr T
|
||||||
rotatel [[gnu::pure]] (const T value, std::size_t magnitude)
|
rotatel [[gnu::pure]] (const T value, std::size_t magnitude)
|
||||||
{
|
{
|
||||||
return (value << magnitude) | (value >> sizeof (value) * 8 - magnitude);
|
return (value << magnitude) | (value >> (sizeof (value) * 8 - magnitude));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ namespace util {
|
|||||||
constexpr T
|
constexpr T
|
||||||
rotater [[gnu::pure]] (const T value, std::size_t magnitude)
|
rotater [[gnu::pure]] (const T value, std::size_t magnitude)
|
||||||
{
|
{
|
||||||
return (value >> magnitude) | (value << sizeof (value) * 8 - magnitude);
|
return (value >> magnitude) | (value << (sizeof (value) * 8 - magnitude));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ template <typename T, unsigned I, unsigned E> \
|
|||||||
fixed<T,I,E> \
|
fixed<T,I,E> \
|
||||||
fixed<T,I,E>::operator OP (integer_type val) const \
|
fixed<T,I,E>::operator OP (integer_type val) const \
|
||||||
{ \
|
{ \
|
||||||
return fixed<T,I,E>::from_native (m_value OP val << E); \
|
return fixed<T,I,E>::from_native (m_value OP (native_type{val} << E)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
SIMPLE_INTEGER_LIT(+)
|
SIMPLE_INTEGER_LIT(+)
|
||||||
|
10
fixed.hpp
10
fixed.hpp
@ -24,7 +24,15 @@
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
template <typename T, unsigned I, unsigned E>
|
template <
|
||||||
|
// whether the type is signed or unsigned. supply an appropriately
|
||||||
|
// signed type here; it won't be used for anything else.
|
||||||
|
typename T,
|
||||||
|
// how many bits total are used for the integral component
|
||||||
|
unsigned I,
|
||||||
|
// how many bits are used for the fractional component
|
||||||
|
unsigned E
|
||||||
|
>
|
||||||
class [[gnu::packed]] fixed {
|
class [[gnu::packed]] fixed {
|
||||||
public:
|
public:
|
||||||
static_assert (I > 0);
|
static_assert (I > 0);
|
||||||
|
@ -76,9 +76,9 @@ jsonish::parse_number (const std::function<callback_t> &cb,
|
|||||||
++cursor;
|
++cursor;
|
||||||
|
|
||||||
auto digit_start = cursor;
|
auto digit_start = cursor;
|
||||||
while (cursor != last && ('0' <= *cursor && *cursor <= '9' ||
|
while (cursor != last && ((('0' <= *cursor) && (*cursor <= '9')) ||
|
||||||
'a' <= *cursor && *cursor <= 'f' ||
|
(('a' <= *cursor) && (*cursor <= 'f')) ||
|
||||||
'A' <= *cursor && *cursor <= 'F'))
|
(('A' <= *cursor) && (*cursor <= 'F'))))
|
||||||
++cursor;
|
++cursor;
|
||||||
if (digit_start == cursor)
|
if (digit_start == cursor)
|
||||||
throw parse_error {cursor};
|
throw parse_error {cursor};
|
||||||
|
Loading…
Reference in New Issue
Block a user