At Fri, 8 Sep 2000 03:49:33 +0900,
Aleksi Niemel<aleksi.niemela / cinnober.com> wrote:
> 
> > I'd like an object to have binary states (each state is either true of
> > false). If I were using plain C, I'd do
> ...
> > is there some convenience and fast function?
> 
> Well, if you want bit-operations they are all there already. Just look
> http://dev.rubycentral.com/ref/ref_c_fixnum.html#Bitoperations
> or the same for Bignums. With bignums you're not hitting the limit of 31
> avalable flags.

well the problem is it's slower than just referencing an instance
variable. I think tradeoff here is memory vs. speed.

using fixnum for flags saves memory, but slow
using an object for each flag saves time, but gets big.

quick test on my system showed me that using bitoperation is 2 times
slower than instance variables reference for three flags. maybe it's
just my stupid code, but don't know how to speed things up.

regards,
--
           yashi