Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
utils.hpp File Reference
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iterator>
#include <string>
#include <vector>
#include <sysio/vm/allocator.hpp>
#include <sysio/vm/stack_elem.hpp>
#include <sysio/vm/utils.hpp>
Include dependency graph for utils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  type_converter32
 
struct  type_converter64
 

Macros

#define BACKEND_TEST_CASE(name, tags)
 

Functions

template<typename T , typename U >
T bit_cast (const U &u)
 
bool check_nan (const std::optional< sysio::vm::operand_stack_elem > &v)
 
sysio::vm::wasm_allocatorget_wasm_allocator ()
 

Macro Definition Documentation

◆ BACKEND_TEST_CASE

#define BACKEND_TEST_CASE ( name,
tags )
Value:

Definition at line 59 of file utils.hpp.

59#define BACKEND_TEST_CASE(name, tags) \
60 TEMPLATE_TEST_CASE(name, tags, sysio::vm::interpreter)

Function Documentation

◆ bit_cast()

template<typename T , typename U >
T bit_cast ( const U & u)

Definition at line 35 of file utils.hpp.

35 {
36 static_assert(sizeof(T) == sizeof(U), "bitcast requires identical sizes.");
37 T result;
38 std::memcpy(&result, &u, sizeof(T));
39 return result;
40}
#define T(meth, val, expected)
Definition dtoa.c:306

◆ check_nan()

bool check_nan ( const std::optional< sysio::vm::operand_stack_elem > & v)
inline

Definition at line 43 of file utils.hpp.

43 {
44 return visit(sysio::vm::overloaded{[](sysio::vm::i32_const_t){ return false; },
45 [](sysio::vm::i64_const_t){ return false; },
46 [](sysio::vm::f32_const_t f) { return std::isnan(f.data.f); },
47 [](sysio::vm::f64_const_t f) { return std::isnan(f.data.f); }}, *v);
48}
constexpr auto visit(Visitor &&vis, Variant &&var)
Definition variant.hpp:156
Here is the caller graph for this function:

◆ get_wasm_allocator()

sysio::vm::wasm_allocator * get_wasm_allocator ( )
inline

Definition at line 50 of file utils.hpp.

50 {
51 static sysio::vm::wasm_allocator alloc;
52 return &alloc;
53}
Here is the caller graph for this function: