bswap expression & ir

This commit is contained in:
Ryan Fleury
2024-08-27 11:35:45 -07:00
parent accc77e03e
commit cf7b664ab2
9 changed files with 67 additions and 9 deletions
+16
View File
@@ -770,6 +770,22 @@ e_interpret(String8 bytecode)
MemoryCopy(&nval.u512[0], (U8 *)(&src_val.u512[0]) + offset, bytes_to_read);
}
}break;
case RDI_EvalOp_ByteSwap:
{
U64 byte_size = imm.u64;
switch(byte_size)
{
default:
{
result.code = E_InterpretationCode_BadOp;
goto done;
}break;
case 2:{nval.u16 = bswap_u16(svals[0].u16);}break;
case 4:{nval.u32 = bswap_u32(svals[0].u32);}break;
case 8:{nval.u64 = bswap_u64(svals[0].u64);}break;
}
}break;
}
// rjf: push