MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / ValueFromType

Function ValueFromType

include/common/types.h:667–685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665// >>>>>>>> Const expression to generate value from value type >>>>>>>>>>>>>>>>>
666
667inline ValVariant ValueFromType(ValType Type) noexcept {
668 switch (Type.getCode()) {
669 case TypeCode::I32:
670 return uint32_t(0U);
671 case TypeCode::I64:
672 return uint64_t(0U);
673 case TypeCode::F32:
674 return float(0.0F);
675 case TypeCode::F64:
676 return double(0.0);
677 case TypeCode::V128:
678 return uint128_t(0U);
679 case TypeCode::Ref:
680 case TypeCode::RefNull:
681 return RefVariant(Type);
682 default:
683 assumingUnreachable();
684 }
685}
686
687// <<<<<<<< Const expression to generate value from value type <<<<<<<<<<<<<<<<<
688

Callers 1

enterFunctionMethod · 0.85

Calls 3

uint128_tClass · 0.85
RefVariantClass · 0.85
getCodeMethod · 0.45

Tested by

no test coverage detected