Boost logo

Boost :

Subject: Re: [boost] Interest request for pointer+bit compressionoptimization
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-09-07 16:32:25

Hi Stephan,
----- Original Message -----
From: "Stefan Strasser" <strasser_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, September 07, 2009 10:32 PM
Subject: Re: [boost] Interest request for pointer+bit compressionoptimization

> Am Monday 07 September 2009 19:00:14 schrieb vicente.botet:
>> Hi,
>> I have recently found in the blog of Joaquin the following optimization
>> consisting in embed a bit into the representation of a pointer. Please read
>> it, it is not too long
>> (
>> I was wondering if it would be interesting to provide some generic template
>> classes making easier this kind of optimization.
> I know that boost.intrusive's rb-tree implements that, and below I quoted its
> way to decide if the pointer is aligned in a way to use the lower bits of the
> pointer.

Thanks for the pointer. So there is already an example of a potential Boost user.

> if you wanted to implement that as a generic template I guess the best way is
> to hide it behind a class that models the concept of a std::pair, or a
> boost::tuple.
> e.g.
> optimized_pair<void *,bool> p(0,false);
> assert(sizeof(p) == sizeof(void *));

Yes, this could be a valid alternative. I would try to implement it.


Boost list run by bdawes at, gregod at, cpdaniel at, john at