Symbol or Convention for Representing Endianness? -


is there symbol, or other convention, indicating endianness of value/variable/what-have-you in technical writing?

that is, if wanted describe algorithm or formula, , represent formula mathematical expression (e.g. x = p + 2 / y), there way of indicating endianness of 1 of variables?

for example:

the following formula shows how calculate new pointer value, npnt.

when working old pointer value, stored in int variable pnt, keep in mind stored little-endian, while new , offset big endian. in order perform mathematical operations using value of pnt, must change pnt big-endian.

int pnt = 0x1722

int new = 0x900f

int offset = 0xf600

npnt = offset + new - pnt

this random example. main thing concerned formula - without paragraph explanation above, there no indication of endianness of each variable in formula.

the solution came superscript arrow symbol variables so:

npnt = offset + new - pnt

or, better yet, put arrows directly above variable names (which can't quite using limited html of so).

is there convention that? or never done because i'm describing/representing things wrong in first place?

for cross-platform code base worked on, used convention of appending _be variables in big-endian byte order , _le in little-endian byte order. else assumed in host byte order.

structures created networking protocols used naming, clear byte order dealing with. had deal both big , little endian values, , sticking convention helped greatly.

if you're consistent, it's hard make mistakes in code. assigning foo_be bar sticks out wrong, , bar = be16toh( foo_be) looks right.

if you're using formatted text, use sub-scripted be or le on value or variable not in host byte order.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -