Skip to content

src/runtime/wasm_result.hpp

Namespaces

Name
sgns
sgns::runtime

Classes

Name
struct sgns::runtime::WasmResult

Source code

#ifndef SUPERGENIUS_SRC_RUNTIME_WASM_RESULT_HPP
#define SUPERGENIUS_SRC_RUNTIME_WASM_RESULT_HPP

#include "runtime/types.hpp"

namespace sgns::runtime {
  struct WasmResult {

    explicit constexpr WasmResult(WasmSpan v) {
      auto [ptr, len] = splitSpan(v);
      address = ptr;
      length = len;
    }

    constexpr WasmResult(WasmPointer ptr, WasmSize size)
        : address{ptr}, length{size} {}

    WasmSpan combine() const {
      return static_cast<WasmSpan>(address)
             | (static_cast<WasmSpan>(length) << 32ull);
    }

    bool operator==(const WasmResult &rhs) const {
      return address == rhs.address && length == rhs.length;
    }

    WasmPointer address = 0u;  
    WasmSize length = 0u;      
  };
}  // namespace sgns::runtime

#endif  // SUPERGENIUS_SRC_RUNTIME_WASM_RESULT_HPP

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