Skip to content

Commit

Permalink
Upon further reflection, the upper 8 bits of 64-bit addresses are 'ca…
Browse files Browse the repository at this point in the history
…nonical', that is, they are ALWAYS a sign extension of bit 48. So we don't have to worry about 'what if the address is bigger than that
  • Loading branch information
eteran committed Oct 31, 2020
1 parent ab87333 commit 7cb67c4
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions qhexview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,11 @@ QString QHexView::formatAddress(address_t address) {
const uint32_t hi = (address >> 32) & 0xffffffff;
const uint32_t lo = (address & 0xffffffff);

// if we encounter a large enough address, just give up on hiding leading zeros
if (address >= 0x8000'0000'0000) {
hideLeadingAddressZeros_ = false;
}

if (hideLeadingAddressZeros_ && address < 0x8000'0000'0000) {
if (hideLeadingAddressZeros_) {
if (showAddressSeparator_) {
qsnprintf(buffer, sizeof(buffer), "%04x:%08x", hi, lo);
qsnprintf(buffer, sizeof(buffer), "%04x:%08x", (hi & 0xffff), lo);
} else {
qsnprintf(buffer, sizeof(buffer), "%04x%08x", hi, lo);
qsnprintf(buffer, sizeof(buffer), "%04x%08x", (hi & 0xffff), lo);
}
} else {
if (showAddressSeparator_) {
Expand Down

0 comments on commit 7cb67c4

Please sign in to comment.