add lz from hykem and more explicit conversions from be for x86