Skip to content

src/runtime/types.hpp

Namespaces

Name
sgns
sgns::runtime

Types

Name
enum WasmLogLevel { WasmLL_Error = 0, WasmLL_Warn = 1, WasmLL_Info = 2, WasmLL_Debug = 3, WasmLL_Trace = 4}
type of wasm log levels
using uint32_t WasmPointer
type of wasm memory is 32 bit integer
using uint64_t WasmSpan
combination of pointer and size, where less significant part represents wasm pointer, and most significant represents size
using uint32_t WasmSize
Size type is uint32_t because we are working in 32 bit address space.
using uint32_t WasmEnum
Enum value is uint32_t.
using uint32_t WasmOffset
Offset type is uint32_t because we are working in 32 bit address space.

Functions

Name
std::pair< WasmPointer, WasmSize > splitSpan(WasmSpan span)

Types Documentation

enum WasmLogLevel

Enumerator Value Description
WasmLL_Error 0
WasmLL_Warn 1
WasmLL_Info 2
WasmLL_Debug 3
WasmLL_Trace 4

type of wasm log levels

using WasmPointer

using sgns::runtime::WasmPointer = uint32_t;

type of wasm memory is 32 bit integer

using WasmSpan

using sgns::runtime::WasmSpan = uint64_t;

combination of pointer and size, where less significant part represents wasm pointer, and most significant represents size

using WasmSize

using sgns::runtime::WasmSize = uint32_t;

Size type is uint32_t because we are working in 32 bit address space.

using WasmEnum

using sgns::runtime::WasmEnum = uint32_t;

Enum value is uint32_t.

using WasmOffset

using sgns::runtime::WasmOffset = uint32_t;

Offset type is uint32_t because we are working in 32 bit address space.

Functions Documentation

function splitSpan

static std::pair< WasmPointer, WasmSize > splitSpan(
    WasmSpan span
)

Splits 64 bit wasm span on 32 bit pointer and 32 bit address

Source code

#ifndef SUPERGENIUS_SRC_RUNTIME_TYPES_HPP
#define SUPERGENIUS_SRC_RUNTIME_TYPES_HPP

#include <cstdint>
#include <utility>

namespace sgns::runtime {
  enum WasmLogLevel {
    WasmLL_Error = 0,
    WasmLL_Warn = 1,
    WasmLL_Info = 2,
    WasmLL_Debug = 3,
    WasmLL_Trace = 4,
  };
  using WasmPointer = uint32_t;
  using WasmSpan = uint64_t;
  using WasmSize = uint32_t;
  using WasmEnum = uint32_t;
  using WasmOffset = uint32_t;

  static constexpr std::pair<WasmPointer, WasmSize> splitSpan(WasmSpan span) {
    auto unsigned_result = static_cast<uint64_t>(span);
    uint64_t minor_part = unsigned_result & 0xFFFFFFFFLLU;
    uint64_t major_part = (unsigned_result >> 32u) & 0xFFFFFFFFLLU;

    return {minor_part, major_part};
  }
}  // namespace sgns::runtime

#endif  // SUPERGENIUS_SRC_RUNTIME_TYPES_HPP

Updated on 2026-03-04 at 13:10:45 -0800