| 394 | } |
| 395 | |
| 396 | Expect<void> Executor::runI31GetOp(ValVariant &Val, |
| 397 | const AST::Instruction &Instr, |
| 398 | const bool IsSigned) const noexcept { |
| 399 | uint32_t RefNum = static_cast<uint32_t>( |
| 400 | reinterpret_cast<uintptr_t>(Val.get<RefVariant>().getPtr<void>())); |
| 401 | if ((RefNum & 0x80000000U) == 0) { |
| 402 | return Unexpect(logError(ErrCode::Value::AccessNullI31, Instr)); |
| 403 | } |
| 404 | RefNum &= 0x7FFFFFFFU; |
| 405 | if (IsSigned) { |
| 406 | RefNum |= ((RefNum & 0x40000000U) << 1); |
| 407 | } |
| 408 | Val.emplace<uint32_t>(RefNum); |
| 409 | return {}; |
| 410 | } |
| 411 | |
| 412 | Expect<RefVariant> |
| 413 | Executor::structNew(Runtime::StackManager &StackMgr, const uint32_t TypeIdx, |