[UNTESTED] complete initial disassembler structure for ARM

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2023-09-15 05:23:07 +05:30
parent 169723275e
commit 7fc6876264
9 changed files with 701 additions and 149 deletions

View File

@@ -7,32 +7,32 @@ using std::size_t;
template<std::integral Int>
inline bool
get_nth_bit(Int num, size_t n) {
get_bit(Int num, size_t n) {
return (num >> n) & 1;
}
template<std::integral Int>
inline void
set_nth_bit(Int& num, size_t n) {
set_bit(Int& num, size_t n) {
num |= (1 << n);
}
template<std::integral Int>
inline void
rst_nth_bit(Int& num, size_t n) {
rst_bit(Int& num, size_t n) {
num &= ~(1 << n);
}
template<std::integral Int>
inline void
chg_nth_bit(Int& num, size_t n, bool x) {
chg_bit(Int& num, size_t n, bool x) {
num = (num & ~(1 << n)) | (x << n);
}
/// read range of bits from start to end inclusive
template<std::integral Int>
inline Int
get_bit_range(Int num, size_t start, size_t end) {
bit_range(Int num, size_t start, size_t end) {
// NOTE: we do not require -1 if it is a signed integral
Int left =
std::numeric_limits<Int>::digits - (std::is_unsigned<Int>::value) - end;