lua-users home
lua-l archive

Re: Bitwise XOR in Lua?

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


* Reuben Thomas <rrt@sc3d.org>:
>> Thanks! However, it would be ideal if I didn't have to (re)compile
>> anything, as the code that uses the function needs to be portable, and
>> some of the target platforms don't have compilers available. Is there a
>> way to implement it in "pure" Lua?
>
> How do you get Lua on the machines without a compiler?
I'm using tomsrtbt [ http://www.toms.net/rb ], which is a "floppy" Linux
distribution. Things compiled to run on it must be staticlly linked, which
my linker doesn't support.
> You can implement XOR in pure Lua but it's very slow. Probably the easiest
> way is to do it bit by bit, but maybe there's a clever trick to do it
> faster with whole-word arithmetic.
Slow isn't really an issue; I just need the ability to XOR in Lua.
-- 
Benjamin D. Esham { http://bdesham.net
bdesham@iname.com } AIM: s c e s a r 1
http://tuxedo.org/~esr/faqs/smart-questions.html

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