ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.9k stars 287 forks source link

[ARM] Added immediate encoding #1340

Closed rajdakin closed 8 months ago

rajdakin commented 8 months ago

This PR adds a function that encodes an immediate value into an integer packing various opcode fields when possible, and returns 0 otherwise. The lowest 6 bits encode the rotation (immr), the next 6 encode the size/pattern (imms), the next bit encodes the N bit and the next one (0x2000) encodes whether the immediate given is encodable (1) or not (0).