[Dwarf-Discuss] DWARF piece questions

Cary Coutant ccoutant at gmail.com
Thu Jan 26 12:37:56 PST 2017


>>> Also, I suggest to avoid the terms "left" and "right", since I
>>> encountered various occasions where they caused more confusion than they
>>> helped.  And the term "most significant" can not generally be applied to
>>> registers either, so in this case I'd prefer something like "located in
>>> the lowest-addressed bytes of the register when stored in memory".
>>
>> I've not found this to be true.
>
> Really?  I usually refer to lower- and higher-addressed memory units by
> "left" and "right", respectively.  However, all diagrams in the Intel 64
> and IA-32 architectures have this reversed and show lower addresses
> below/right and higher addresses above/left.  Similarly, when referring
> to the bytes in a register I'd call the lower- and higher-addressed
> bytes (in natural memory representation) "left" and "right",
> respectively.  But at least for integer registers some people call the
> most significant bytes "left", independently from byte ordering.  I had
> a lengthy discussion with Jian Xu, where one of our misunderstandings
> was centered around the definition of "left" and "right".  How do you
> interpret these terms?

I've been guilty of using "left" and "right", and been called out on
it, even when the context was referring simply to bits within a byte
or within a register. I thought they'd be unambiguous in that context,
but they do seem to cause uncertainty, probably for the very reason
that some little-endian diagrams will depict bytes forming a larger
unit from right-to-left.

Instead, I now try to stick with "most-significant" and
"least-significant" when talking about bits within a larger unit, or
bytes within a word, which should always be unambiguous. I really
don't see how those terms could lead to any uncertainty.

When talking about bytes in memory, I try to use "lower address" and
"higher address".

I would, however, avoid referring to bytes within a register. It would
be better to talk about how a byte in memory is placed in the
register, and it should be clear to say something like "a byte is
loaded into the least-significant bits of the register."

-cary


More information about the Dwarf-Discuss mailing list