lua-users home
lua-l archive

Re: [ANN] Lua 5.3.0 (work2) now available

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


> As a side note, arithmetic shift is NOT equivalent to division by a power of two as the two functions have different rounding properties for negative dividends. Assuming you are using a C compiler that *does* do arithmetic shifts with signed operands, the following code will simulate integer division using shifts only:
This is in C. In Lua both are equivalent; integer division in Lua rounds
toward minus infinity, like an arithmetic shift.
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /