1

I've searched around and can't find anything on what the middle bytes of a >16-bit integer are called, if anything. Are there standard names for these bytes?

E.g. the number 0x0D0C0B0A would have:

MSB ??? ??? LSB
 0D  0C  0B  0A
7
  • "Next most significant byte" and "next least significant byte" Commented Jul 15, 2014 at 19:07
  • 12
    MSB and LSB are only used in the sense of stablishing the order in which they must be interpreted due to the issues with endianness, not for the sake of naming things. Once the order it is clear, then they are the first, the second, the third...
    – SJuan76
    Commented Jul 15, 2014 at 19:07
  • @SJuan76 hm, makes sense. I'll wait to see if I get any other good answers, but if you would like to post that as an answer I'll definitely upvote (and probably accept) it. Also, I assume "first" = LSB?
    – paul
    Commented Jul 15, 2014 at 21:00
  • I know you say you only care about 32 bit ints, but history is littered with the bodies of programmers that make presumptions like this. Whatever the answer, restricting it to 32 bit ints is wrong.
    – mattnz
    Commented Jul 16, 2014 at 4:50
  • Oh, it is more of a comment. You MIGHT use MSB and LSB in that sense; I just wanted to point out that it is no the usual usage and that (AFAIK) there are no "standard" names for the things you are looking for. Check this link I scrapped from one of the sidebar links: commandcenter.blogspot.com/2012/04/byte-order-fallacy.html
    – SJuan76
    Commented Jul 16, 2014 at 12:41

3 Answers 3

3

I guess once MSB determines the order, I call them byte 0, byte 1, byte 2, and then either byte 3 or else MSB.

2

I've been developing on embedded systems for a couple of decades, and have the same problem with a sensible naming.

I've seen many approachs, including mapping an overlay array of bytes and just using indexes (which does not solve the problem at all as endianness is not taken into account).

I eventually settled on MSB, MMSB, MLSB, LSB (where the extra M means "middle").

But really, anything at all that you do which is remotely sensible* will suffice.

*sensible in this sense means that there is a name with some kind of rationale behind it. Calling them bob and fred would not be sensible.

1
  • What I was going to do was use a union of a 32-bit int and a struct which contained the individual bytes -- with the bytes in the struct ordered according to endianness (intel: little). I might just end up forgoing naming and do the add & bit-shift method of constructing the int.
    – paul
    Commented Jul 16, 2014 at 13:22
1

I call them "bytes".

So does everyone I've worked with. Lacking a commonly used nomenclature, you either adopt a idiosyncratic scheme which no one else will understand, or you throw more words at it when you need to disambiguate.

Not the answer you're looking for? Browse other questions tagged or ask your own question.