#include <stdint.h>
#include <cmath>
#include <type_traits>
#include "src/base/macros.h"
Go to the source code of this file.
◆ ASSERT_SIGNED_INTEGER_TYPE
#define ASSERT_SIGNED_INTEGER_TYPE |
( |
| Type | ) |
|
Value: static_assert(std::is_integral<Type>::value && std::is_signed<Type>::value, \
"use this for signed integer types");
Definition at line 20 of file overflowing-math.h.
◆ OP_WITH_WRAPAROUND
#define OP_WITH_WRAPAROUND |
( |
| Name, |
|
|
| OP ) |
Value: template <typename signed_type> \
inline signed_type Name##WithWraparound(signed_type a, signed_type b) { \
ASSERT_SIGNED_INTEGER_TYPE(signed_type); \
using unsigned_type = typename std::make_unsigned<signed_type>::type; \
unsigned_type a_unsigned =
static_cast<unsigned_type
>(
a); \
unsigned_type b_unsigned = static_cast<unsigned_type>(b); \
unsigned_type
result = a_unsigned
OP b_unsigned; \
return static_cast<signed_type
>(
result); \
}
std::optional< TNode< JSArray > > a
ZoneVector< RpoNumber > & result
Definition at line 23 of file overflowing-math.h.