Kagome
Polkadot Runtime Engine in C++17
types.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_RUNTIME_TYPES_HPP
7 #define KAGOME_RUNTIME_TYPES_HPP
8 
9 #include <cstdint>
10 #include <utility>
11 
12 namespace kagome::runtime {
16  enum class WasmLogLevel {
17  Error = 0,
18  Warn = 1,
19  Info = 2,
20  Debug = 3,
21  Trace = 4,
22  };
26  using WasmPointer = uint32_t;
31  using WasmSpan = uint64_t;
35  using WasmSize = uint32_t;
39  using WasmEnum = uint32_t;
44  using WasmOffset = uint32_t;
45 
46  using WasmI32 = int32_t;
47  using WasmU64 = uint64_t;
48 
52  static constexpr std::pair<WasmPointer, WasmSize> splitSpan(WasmSpan span) {
53  const auto unsigned_result = static_cast<uint64_t>(span);
54  const uint32_t minor_part = unsigned_result & 0xFFFFFFFFLLU;
55  const uint32_t major_part = (unsigned_result >> 32u) & 0xFFFFFFFFLLU;
56 
57  return {minor_part, major_part};
58  }
59 } // namespace kagome::runtime
60 
61 #endif // KAGOME_RUNTIME_TYPES_HPP
uint64_t WasmU64
Definition: types.hpp:47
static constexpr std::pair< WasmPointer, WasmSize > splitSpan(WasmSpan span)
Definition: types.hpp:52
uint32_t WasmSize
Size type is uint32_t because we are working in 32 bit address space.
Definition: types.hpp:35
uint32_t WasmOffset
Offset type is uint32_t because we are working in 32 bit address space.
Definition: types.hpp:44
int32_t WasmI32
Definition: types.hpp:46
WasmLogLevel
type of wasm log levels
Definition: types.hpp:16
uint64_t WasmSpan
combination of pointer and size, where less significant part represents wasm pointer, and most significant represents size
Definition: types.hpp:31
uint32_t WasmEnum
Enum value is uint32_t.
Definition: types.hpp:39
uint32_t WasmPointer
type of wasm memory is 32 bit integer
Definition: types.hpp:26