diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc index 693fad8dda40fd..0acfc46fe43953 100644 --- a/src/node_snapshotable.cc +++ b/src/node_snapshotable.cc @@ -166,22 +166,19 @@ class SnapshotSerializerDeserializer { V(std::string) #define V(TypeName) \ - if (std::is_same_v) { \ + if constexpr (std::is_same_v) { \ return #TypeName; \ - } + } else // NOLINT(readability/braces) TYPE_LIST(V) #undef V - std::string name; - if (std::is_arithmetic_v) { - if (!std::is_signed_v) { - name += "u"; - } - name += std::is_integral_v ? "int" : "float"; - name += std::to_string(sizeof(T) * 8); - name += "_t"; + if constexpr (std::is_arithmetic_v) { + return (std::is_unsigned_v ? "uint" + : std::is_integral_v ? "int" + : "float") + + std::to_string(sizeof(T) * 8) + "_t"; } - return name; + return ""; } bool is_debug = false;