|
Boost : |
Subject: Re: [boost] Google Summer Of Code
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-03-18 14:05:47
----- Original Message -----
From: "Brian Bartman" <bbartmanboost_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, March 18, 2010 2:45 PM
Subject: [boost] Google Summer Of Code
>
> Hello my name is Brian Bartman and I am an undergraduate at Kent State
> University Majoring in computer science.
>
> I was interested in the bits & ints project, specifically Compressed array
> and Compressed vector as well as the utilities for bit mask manipulation.
>
> Could some one help me better understand the requirements of this project?
> I would like to draft a proposal for GSoC 2010 and wanted to better
> understand the project before I write a proposal.
Hello,
I don't know if you are interested in improving Boost.Bitfield. I had two features I wanted to add since long time but I had not time lastly finish them. You can find information related to Boost.Bitfield in https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Bitfield.
The two features are:
* Add bitfields group
Used to easily manipulate groups of bitfields the same way as does C bitfields, but in a portable manner. Example declaration:
struct Rgb565
{
struct red {};
struct green {};
struct blue {};
typedef bitfields<
member<unsigned char, red, 5>,
member<unsigned char, green, 6>,
member<unsigned char, blue, 5>
> type;
};
Example usage:
Rgb565::type r = make_bitfields<Rgb565::type, 1,2,3>;
// Write to a bitfield.
r.get<Rgb565::red>() = 23;
//or
r.set<Rgb565::red>(23);
// Read from a bitfield
Rgb565::at<Rgb565::blue>::value_type b = r.get<Rgb565::blue>();
Other posibility could be to use unamed bitfields whic are accessed as tuples.
typedef bitfields_group<5,6,5 > Rgb565;
Rgb565 r;
r.get<0>() = 23;
// or
r.set<0>(23);
// Read from a bitfield
Rgb565::at<2>::value_type b = r.get<2>();
* Add pointer_plus_bits
Based on
- the article of Joaquin Optimizing red-black tree color bits (http://bannalia.blogspot.com/2008/11/optimizing-red-black-tree-color-bits.html),
- the implementation of Ion pointer_plus_bits from Boost.Intrusive (http://www.boost.org/boost/boost/intrusive/pointer_plus_bits.hpp) , and
- Clang's QualType smart pointer (Clang's QualType smart pointer)
This class will allows to use the unsused bits of a pointer to reduce the size of the nodes containing pointers and bits and sometimes improving also the performances.
I have not reached yet the interface I would like to have. For the moment we can do
typedef pointer_plus_bits<int*,1,bool>::type pint_and_bool;
int i=0;
pint_and_bool v1;
ASSERT_EQUALS(v1.pointer(),0);
ASSERT_EQUALS(v1.small_int(),false);
pint_and_bool v2(&i, true);
ASSERT_EQUALS(v2.pointer(),&i);
ASSERT_EQUALS(v2.small_int(),true);
v1.pointer()=v2.pointer();
v1.small_int()=true;
ASSERT_EQUALS(v1.pointer(),&i);
ASSERT_EQUALS(v1.small_int(),true);
typedef pointer_plus_bits<
pointer_plus_bits<int*,1,bool>::type
,1, bool>::type pint_and_bool_bool
pint_and_bool_bool v1;
ASSERT_EQUALS(v1.small_int(),false);
ASSERT_EQUALS(v1.pointer().get_pointer(),0);
ASSERT_EQUALS(v1.get_pointer().get_pointer(),0);
ASSERT_EQUALS(v1.get_pointer().small_int(),false);
Let me know if this is related to what you are interested in.
best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk