Skip to content

Commit 66a5720

Browse files
committed
Avoid warnings in msvc with new preprocessor
1 parent d3849c3 commit 66a5720

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

include/intx/intx.hpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,16 +1608,19 @@ constexpr uint256 mulmod(const uint256& x, const uint256& y, const uint256& mod)
16081608
return udivrem(umul(x, y), mod).rem;
16091609
}
16101610

1611+
#define INTX_JOIN2(X, Y) X##Y
1612+
#define INTX_JOIN1(X, Y) INTX_JOIN2(X, Y)
1613+
#define INTX_LITERAL(N) INTX_JOIN1("", INTX_JOIN1(_u, N))
16111614
/// Define type alias uintN = uint<N> and the matching literal ""_uN.
16121615
/// The literal operators are defined in the intx::literals namespace.
1613-
#define DEFINE_ALIAS_AND_LITERAL(N) \
1614-
using uint##N = uint<N>; \
1615-
namespace literals \
1616-
{ \
1617-
consteval uint##N operator""_u##N(const char* s) \
1618-
{ \
1619-
return from_string<uint##N>(s); \
1620-
} \
1616+
#define DEFINE_ALIAS_AND_LITERAL(N) \
1617+
using uint##N = uint<N>; \
1618+
namespace literals \
1619+
{ \
1620+
consteval uint##N operator INTX_LITERAL(N)(const char* s) \
1621+
{ \
1622+
return from_string<uint##N>(s); \
1623+
} \
16211624
}
16221625
DEFINE_ALIAS_AND_LITERAL(128);
16231626
DEFINE_ALIAS_AND_LITERAL(192);
@@ -1627,6 +1630,9 @@ DEFINE_ALIAS_AND_LITERAL(384);
16271630
DEFINE_ALIAS_AND_LITERAL(448);
16281631
DEFINE_ALIAS_AND_LITERAL(512);
16291632
#undef DEFINE_ALIAS_AND_LITERAL
1633+
#undef INTX_JOIN2
1634+
#undef INTX_JOIN1
1635+
#undef INTX_LITERAL
16301636

16311637
using namespace literals;
16321638

0 commit comments

Comments
 (0)