summaryrefslogtreecommitdiff
path: root/include/wabt/interp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2022-11-15 08:54:09 -0800
committerGitHub <noreply@github.com>2022-11-15 08:54:09 -0800
commitd3e4ab30720c48d0c019fa521d70362b1bdd2bae (patch)
tree1a7a5f0d0e80b4c33038ae63c7362518f5a18f88 /include/wabt/interp
parentf7a3ab3f33c9119d1dffaa0c642436049e2a21d3 (diff)
downloadwabt-d3e4ab30720c48d0c019fa521d70362b1bdd2bae.tar.gz
wabt-d3e4ab30720c48d0c019fa521d70362b1bdd2bae.tar.bz2
wabt-d3e4ab30720c48d0c019fa521d70362b1bdd2bae.zip
Prefer `constexpr` over `static const`. NFC (#2065)
IIUC this is preferred in modern C++ and expresses indent better.
Diffstat (limited to 'include/wabt/interp')
-rw-r--r--include/wabt/interp/interp.h8
-rw-r--r--include/wabt/interp/istream.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/include/wabt/interp/interp.h b/include/wabt/interp/interp.h
index 6d4a6a01..bb3cf487 100644
--- a/include/wabt/interp/interp.h
+++ b/include/wabt/interp/interp.h
@@ -96,7 +96,7 @@ enum class ObjectKind {
Last = Instance,
};
-static const int kCommandTypeCount = WABT_ENUM_COUNT(ObjectKind);
+constexpr int kCommandTypeCount = WABT_ENUM_COUNT(ObjectKind);
const char* GetName(Mutability);
const std::string GetName(ValueType);
@@ -119,7 +119,7 @@ using RefVec = std::vector<Ref>;
template <typename T, u8 L>
struct Simd {
using LaneType = T;
- static const u8 lanes = L;
+ static constexpr u8 lanes = L;
T v[L];
@@ -1086,8 +1086,8 @@ enum class RunResult {
class Thread {
public:
struct Options {
- static const u32 kDefaultValueStackSize = 64 * 1024 / sizeof(Value);
- static const u32 kDefaultCallStackSize = 64 * 1024 / sizeof(Frame);
+ static constexpr u32 kDefaultValueStackSize = 64 * 1024 / sizeof(Value);
+ static constexpr u32 kDefaultCallStackSize = 64 * 1024 / sizeof(Frame);
u32 value_stack_size = kDefaultValueStackSize;
u32 call_stack_size = kDefaultCallStackSize;
diff --git a/include/wabt/interp/istream.h b/include/wabt/interp/istream.h
index 06e1cfca..f8eb6a26 100644
--- a/include/wabt/interp/istream.h
+++ b/include/wabt/interp/istream.h
@@ -95,7 +95,7 @@ class Istream {
public:
using SerializedOpcode = u32; // TODO: change to u16
using Offset = u32;
- static const Offset kInvalidOffset = ~0;
+ static constexpr Offset kInvalidOffset = ~0;
// Each br_table entry is made up of three instructions:
//
// interp_drop_keep $drop $keep
@@ -103,7 +103,7 @@ class Istream {
// br $label
//
// Each opcode is a SerializedOpcode, and each immediate is a u32.
- static const Offset kBrTableEntrySize =
+ static constexpr Offset kBrTableEntrySize =
sizeof(SerializedOpcode) * 3 + 4 * sizeof(u32);
// Emit API.