lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Nov 21, 2012 at 04:08:12PM -0500, Javier Guerra Giraldez wrote:
> On Wed, Nov 21, 2012 at 3:42 PM, Jay Carlson <nop@nop.com> wrote:
> >>       x = (string.byte(s, 1) * 256) + string.byte(s, 2)
> >
> > I find it comforting somebody else still thinks big-endian.
> 
> it's the only sane way ;-)
> 
> besides, it's the standard "net order", or at least it was until the
> "use text protocols!" vogue made talk of byte order obscene...

Text protocols are big-endian, too! They parse the same--load, shift, load,
shift, etc.

I still see little-endian formats coming out, usually when either Microsoft
or Intel has a hand in the specification. It's extremely annoying when
writing parsers, especially when they use it for binary strings like 128-bit
identifiers... as if you can just type pun that into a C object.