lua-users home
lua-l archive

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


Am 08.07.2013 11:46 schröbte Tony Finch:
Miles Bader <miles@gnu.org> wrote:

I haven't looked at the implementation, but I suppose it may simply
use C unsigned values to represent integers, or when doing arithmetic
on them ...

Yes. In lvm.h:

#define intop(op,v1,v2) \
	cast_integer(cast_unsigned(v1) op cast_unsigned(v2))

That may not do what is expected, because it involves implementation-defined behavior:

3.2.1.2 Signed and unsigned integers
[...] When an integer is demoted to a signed integer with smaller size, or an unsigned integer is converted to its corresponding signed integer, if the value cannot be represented the result is implementation-defined.

Philipp