a64 emitter: Move IsInRange* and MaskImm* into anon namespace

This commit is contained in:
SachinVin 2019-07-15 20:44:11 +05:30 committed by xperia64
parent 157435bd07
commit c45d11e0af

View File

@ -276,6 +276,31 @@ bool FPImm8FromFloat(float value, u8* imm_out) {
return true;
}
static constexpr bool IsInRangeImm19(s64 distance) {
return (distance >= -0x40000 && distance <= 0x3FFFF);
}
static constexpr bool IsInRangeImm14(s64 distance) {
return (distance >= -0x2000 && distance <= 0x1FFF);
}
static constexpr bool IsInRangeImm26(s64 distance) {
return (distance >= -0x2000000 && distance <= 0x1FFFFFF);
}
static constexpr u32 MaskImm19(s64 distance) {
return distance & 0x7FFFF;
}
static constexpr u32 MaskImm14(s64 distance) {
return distance & 0x3FFF;
}
static constexpr u32 MaskImm26(s64 distance) {
return distance & 0x3FFFFFF;
}
} // Anonymous namespace
void ARM64XEmitter::SetCodePtrUnsafe(u8* ptr) {
@ -831,30 +856,6 @@ void ARM64XEmitter::EncodeLoadStoreUnscaled(u32 size, u32 op, ARM64Reg Rt, ARM64
Write32((size << 30) | (0b111 << 27) | (op << 22) | ((imm & 0x1FF) << 12) | (Rn << 5) | Rt);
}
static constexpr bool IsInRangeImm19(s64 distance) {
return (distance >= -0x40000 && distance <= 0x3FFFF);
}
static constexpr bool IsInRangeImm14(s64 distance) {
return (distance >= -0x2000 && distance <= 0x1FFF);
}
static constexpr bool IsInRangeImm26(s64 distance) {
return (distance >= -0x2000000 && distance <= 0x1FFFFFF);
}
static constexpr u32 MaskImm19(s64 distance) {
return distance & 0x7FFFF;
}
static constexpr u32 MaskImm14(s64 distance) {
return distance & 0x3FFF;
}
static constexpr u32 MaskImm26(s64 distance) {
return distance & 0x3FFFFFF;
}
// FixupBranch branching
void ARM64XEmitter::SetJumpTarget(FixupBranch const& branch) {
bool Not = false;