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

Re: 32b long int???????



On 13 Dec, Bjarke Hammersholt Roune wrote:
>> Perhaps:        long test[2] ?
>>
> You could do that, but I'd advise you to encapsulate it in a class, as
> else it'll be major pain to use that thing. You can't just say "test +
> test2", no, you have to do the first addition with the first two longs
> of test and test, find out how much "spills over" from that, and then do
> a second add with the next two longs of test and test two and add the
> "spill over" from the first add (atleast, that's how I think it goes :).
> 
> Anyway, its just much nicer to have the compiler do that, if you
> compiler supports it.
> 
> Else, make a class if you REALLY need it.

I deleted the original posters mail, but if they just needed a set of
flags and are using C++, they could consider using the bitset template
from the STL.  IIRC bitset lets you flip individual bits as well as 
performing all the logic ops.

--Alan

-- 
Alan Chen
Aerospace Simulation Engineer and Recovering Linux Newbie
Now Running: Redhat 6.0 + Tweaks