lua-users home
lua-l archive

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


> Apart from that, I think some of my results are
> better than his (especially right shifting negative
> numbers gives more sensible results), owing to careful
> casting. I like John's use of macros, which could be
> adopted to good effect in lmathlib.c. I provide signed
> and unsigned right shifts (assuming a sensible compiler
> that does signed shifts on signed quantities; this is
> optional for ANSI C, but mandatory for ISO C).

Yes, your modifications make the code I posted stronger, although I've
gotten plenty of commentary from people who think that any use of macros to
generate code is an instant crime against all that is holy and pure.  Still,
when slumming in C, it comes naturally.  The original version of the bitwise
operations library I posted was just quickly hacked out, more of a practical
effort than a general one.

What I haven't done yet is to check if my original code (or your updated
version) works properly under Lua 4.0 beta.  I've remained stuck on 4.0
alpha both because of laziness, and because I'm more than happy to let other
people to work through the problems in the beta code!  Will the bitwise
operations code continue to work under 4.0 beta (and presumably the upcoming
release of 4.0)?