WasmValue Struct

A WebAssembly value (https://webassembly.github.io/spec/core/exec/runtime.html#values). The references are null (a null reference of any type), a WasmFunction, a WasmHostReference (a value of the host), a WasmI31Reference, a WasmGcObject or a WasmExceptionReference.

public readonly struct WasmValue : IEquatable<WasmValue>
Implements

Properties

NameDescription
F32Gets the value of an f32.
F32BitsGets the bits of an f32 value (the payload of a NaN is preserved).
F64Gets the value of an f64.
F64BitsGets the bits of an f64 value (the payload of a NaN is preserved).
I32Gets the value of an i32.
I64Gets the value of an i64.
KindGets the kind of the value.
NullGets a null reference.
ReferenceGets the referenced object of a reference, or null for a null reference.
V128HighGets the high 64 bits of a v128 value.
V128LowGets the low 64 bits of a v128 value.

Gets the value of an f32.

public float F32 { get; }

Property value

float

Gets the bits of an f32 value (the payload of a NaN is preserved).

public int F32Bits { get; }

Property value

int

Gets the value of an f64.

public double F64 { get; }

Property value

double

Gets the bits of an f64 value (the payload of a NaN is preserved).

public long F64Bits { get; }

Property value

long

Gets the value of an i32.

public int I32 { get; }

Property value

int

Gets the value of an i64.

public long I64 { get; }

Property value

long

Gets the kind of the value.

public WasmValueKind Kind { get; }

Property value

WasmValueKind

Gets a null reference.

public static WasmValue Null { get; }

Property value

WasmValue

Reference

WasmValue.cs

Gets the referenced object of a reference, or null for a null reference.

public object? Reference { get; }

Property value

object?

V128High

WasmValue.cs

Gets the high 64 bits of a v128 value.

public long V128High { get; }

Property value

long

Gets the low 64 bits of a v128 value.

public long V128Low { get; }

Property value

long

Methods

NameDescription
Default(WasmValueType)Returns the default value of a type (https://webassembly.github.io/spec/core/exec/runtime.html#default-val): zero, or a null reference.
Equals(WasmValue)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
FromF32(float)Creates an f32 value.
FromF32Bits(int)Creates an f32 value from its bits.
FromF64(double)Creates an f64 value.
FromF64Bits(long)Creates an f64 value from its bits.
FromHostValue(object?)Creates an externref to a value of the host, or a null reference when value is null.
FromI32(int)Creates an i32 value.
FromI64(long)Creates an i64 value.
FromReference(object?)Creates a reference, or a null reference when reference is null: a WasmFunction, a WasmHostReference, a WasmI31Reference, a WasmGcObject or a WasmExceptionReference.
FromV128(long, long)Creates a v128 value.
GetHashCode()Returns the hash code for this instance.
ToString()Returns the fully qualified type name of this instance.

Default(WasmValueType)

WasmValue.cs

Returns the default value of a type (https://webassembly.github.io/spec/core/exec/runtime.html#default-val): zero, or a null reference.

public static WasmValue Default(WasmValueType type)

Parameters

type WasmValueType

Returns

WasmValue

Equals overloads

Equals(WasmValue)

WasmValue.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(WasmValue other)
Parameters
other WasmValue
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

WasmValue.cs

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

FromF32(float)

WasmValue.cs

Creates an f32 value.

public static WasmValue FromF32(float value)

Parameters

value float

Returns

WasmValue

FromF32Bits(int)

WasmValue.cs

Creates an f32 value from its bits.

public static WasmValue FromF32Bits(int bits)

Parameters

bits int

Returns

WasmValue

FromF64(double)

WasmValue.cs

Creates an f64 value.

public static WasmValue FromF64(double value)

Parameters

value double

Returns

WasmValue

FromF64Bits(long)

WasmValue.cs

Creates an f64 value from its bits.

public static WasmValue FromF64Bits(long bits)

Parameters

bits long

Returns

WasmValue

FromHostValue(object?)

WasmValue.cs

Creates an externref to a value of the host, or a null reference when value is null.

public static WasmValue FromHostValue(object? value)

Parameters

value object?

Returns

WasmValue

FromI32(int)

WasmValue.cs

Creates an i32 value.

public static WasmValue FromI32(int value)

Parameters

value int

Returns

WasmValue

FromI64(long)

WasmValue.cs

Creates an i64 value.

public static WasmValue FromI64(long value)

Parameters

value long

Returns

WasmValue

FromReference(object?)

WasmValue.cs

Creates a reference, or a null reference when reference is null: a WasmFunction, a WasmHostReference, a WasmI31Reference, a WasmGcObject or a WasmExceptionReference.

public static WasmValue FromReference(object? reference)

Parameters

reference object?

Returns

WasmValue

FromV128(long, long)

WasmValue.cs

Creates a v128 value.

public static WasmValue FromV128(long low, long high)

Parameters

low long
high long

Returns

WasmValue

GetHashCode()

WasmValue.cs

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

ToString()

WasmValue.cs

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string The fully qualified type name.

Operators

NameDescription
operator ==(WasmValue, WasmValue)Compares two values: the bits of the numbers, and the identity of the references.
operator !=(WasmValue, WasmValue)Compares two values: the bits of the numbers, and the identity of the references.

operator ==(WasmValue, WasmValue)

WasmValue.cs

Compares two values: the bits of the numbers, and the identity of the references.

public static bool operator ==(WasmValue left, WasmValue right)

Parameters

left WasmValue
right WasmValue

Returns

bool

operator !=(WasmValue, WasmValue)

WasmValue.cs

Compares two values: the bits of the numbers, and the identity of the references.

public static bool operator !=(WasmValue left, WasmValue right)

Parameters

left WasmValue
right WasmValue

Returns

bool