diff options
Diffstat (limited to 'src/wasm-type.h')
-rw-r--r-- | src/wasm-type.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/wasm-type.h b/src/wasm-type.h index c4d719a35..53ef39ef8 100644 --- a/src/wasm-type.h +++ b/src/wasm-type.h @@ -79,6 +79,21 @@ public: // Allows for using Types in switch statements constexpr operator uint32_t() const { return id; } + + // Returns the type size in bytes. Only single types are supported. + unsigned getByteSize() const; + + // Reinterpret an integer type to a float type with the same size and vice + // versa. Only single integer and float types are supported. + Type reinterpret() const; + + // Returns the feature set required to use this type. + FeatureSet getFeatures() const; + + // Returns a number type based on its size in bytes and whether it is a float + // type. + static Type get(unsigned byteSize, bool float_); + std::string toString() const; }; @@ -123,11 +138,6 @@ constexpr Type anyref = Type::anyref; constexpr Type exnref = Type::exnref; constexpr Type unreachable = Type::unreachable; -unsigned getTypeSize(Type type); -FeatureSet getFeatures(Type type); -Type getType(unsigned size, bool float_); -Type reinterpretType(Type type); - } // namespace wasm template<> class std::hash<wasm::Signature> { |