fix the way endianness is detected

see this thread: http://lua-users.org/lists/lua-l/2008-11/msg00075.html