Repository: dotnet/runtime
File: src/coreclr/jit/emitwasm.cpp (C++)

Code before:
        {
            dst += emitOutputOpcode(dst, ins);
            break;
        }
        case IF_BLOCK:
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputByte(dst, 0x40 /* block type of void */);
            break;
        case IF_ULEB128:
        {
            assert(!id->idIsCnsReloc());
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputULEB128(dst, (uint64_t)emitGetInsSC(id));
            break;
        }
        case IF_SLEB128:
        {
            assert(!id->idIsCnsReloc());
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputSLEB128(dst, (int64_t)emitGetInsSC(id));
            break;
        }
        case IF_MEMADDR:
        {
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputConstant(dst, id, true, CorInfoReloc::WASM_MEMORY_ADDR_SLEB);
            break;
        }
        case IF_FUNCPTR:
        {
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputConstant(dst, id, true, CorInfoReloc::WASM_TABLE_INDEX_SLEB);
            break;
        }
        case IF_CALL:
        {
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputConstant(dst, id, false, CorInfoReloc::WASM_FUNCTION_INDEX_LEB);
            break;
        }
        case IF_CALL_INDIRECT:
        {
            dst += emitOutputByte(dst, opcode);
            dst += emitOutputConstant(dst, id, false, CorInfoReloc::WASM_TYPE_INDEX_LEB);
            dst += emitOutputULEB128(dst, 0);
            break;
        }
        case IF_F32:
        {
            dst += emitOutputOpcode(dst, ins);
            // Reinterpret the bits as a double constant and then truncate it to f32,

Review comment (suggestion):
```suggestion
            dst += emitOutputConstant(dst, id, /* isSigned */ true, CorInfoReloc::WASM_MEMORY_ADDR_SLEB);
```
Similar below.

Or you can do a trick with `static const bool SIGNED = true; static const bool UNSIGNED = false;`.

(Or split the reloc-aware functions into signed/unsigned the same as the non-reloc ones)

Code after:
size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp)
{
    const bool SIGNED   = true;
    const bool UNSIGNED = false;

    BYTE*       dst    = *dp;
    size_t      sz     = emitSizeOfInsDsc(id);
    instruction ins    = id->idIns();
    insFormat   insFmt = id->idInsFmt();
    unsigned    opcode = GetInsOpcode(ins);

    switch (insFmt)
    {
        case IF_OPCODE:
        {
            dst += emitOutputOpcode(dst, ins);
            break;
        }
        case IF_BLOCK:
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputByte(dst, 0x40 /* block type of void */);
            break;
        case IF_ULEB128:
        {
            assert(!id->idIsCnsReloc());
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputULEB128(dst, (uint64_t)emitGetInsSC(id));
            break;
        }
        case IF_SLEB128:
        {
            assert(!id->idIsCnsReloc());
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputSLEB128(dst, (int64_t)emitGetInsSC(id));
            break;
        }
        case IF_MEMADDR:
        {
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputConstant(dst, id, SIGNED, CorInfoReloc::WASM_MEMORY_ADDR_SLEB);
            break;
        }
        case IF_FUNCPTR:
        {
            dst += emitOutputOpcode(dst, ins);
            dst += emitOutputConstant(dst, id, SIGNED, CorInfoReloc::WASM_TABLE_INDEX_SLEB);
            break;
        }
        case IF_FUNCIDX:
        {
            dst += emitOutputOpcode(dst, ins);