lua-users home
lua-l archive

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



On Sep 21, 2008, at 12:18 PM, Mike Pall wrote:


Whether to write bit.band(a, 0xffff0000) or bit.band(a, -0x10000)
is the programmer's choice. Of course the former is largely
preferred, but the implementation doesn't care.

Just for completeness, this is only true for CPU architectures that
implement 2's complement arithmetic.  While 1's complement CPU
architectures [1] are even more rare than non-IEEE floating point
implementations in this century, portability goals might lead
you to a less architecture-specific definition.

Louis Mamakos

[1] UNIVAC/Sperry/Unisys 1100/2200 architectures, DEC-10/20 among
them.