Boost logo

Boost :

Subject: [boost] [xint] Review
From: Jarrad Waterloo (jwaterloo_at_[hidden])
Date: 2011-03-10 09:50:28


I do believe this library should be added to Boost provided the author is committed to supporting it and taking into consideration, at least, the comments raised by everyone's review.

1) What is your evaluation of the design?
I like it. It mostly behaves like an ordinary integer. It is more than adequate for my needs. Potential enhancemnts which should not limit its adoption would include the following.

1.1) convenience functions for extracting sub integers ie. bit fields
1.2) convenience functions for creating masks
1.3) support for bitsets
1.4) support for dynamic bitsets ie. partial specialization vector<bool> from C++1x

2) What is your evaluation of the implementation?
I am more concerned with the public interface which is mostly correct with the exception of incremental operators which was raised by another. I do expect speed enhancements to come over time and am pleased that it has the slower but standard C++ cross platform algorithms for the general case.

Other reviewers have proposed the following of which I agree but don't mind if they come in another release.
2.a) Separate algorithms from integer
2.b) Provide a fixed size that is completely stack allocated and is exactly the size with no overhead using 2's complement like int now
2.c) Get rid of virtual
2.d) allow integer to be created with allocators

I believe all of those suggestions are related. You should split your class back into two one dynamically allocated like a vector<int> and another which stack allocated like int or bitset. [Sorry, I know that at one time it was like this.] You can get your reuse by separating the algorithms and having your two or more classes do inline calls to them. This will also provide the algorithms so that others can use it on their own containers. Since these are separate sealed classes than their is no need for the virtual. The dynamic variant should than support allocators.

Either way, I consider these mostly internal implementation details as I use the operators and typedefs when working with this library.

3) What is your evaluation of the documentation?
Adequate to teach me how to use it.
I do agree that all references to it being fast should be replaced with a request for faster preferably assembly level patches.
It was lacking in examples of masks and bit fields which can be performed on regular integers but wasn't absolutely clear on this class of so many configuration options.

4) What is your evaluation of the potential usefulness of the library?
Very useful and much needed

5) Did you try to use the library? With what compiler? Did you have any problems?
Yes. GCC and VS8 and VS10. No problems

6) How much effort did you put into your evaluation? A glance? A quick reading? In-depth study?
In-depth study with respect to my problem domains and also have been following everyone else review and comments.

7) Are you knowledgeable about the problem domain?
 From the domains of using cryptographic algorithms for licensing and large numbers for working with id tagging of products where speed is not paramount than yes. No with respect to cryptography and cryptanalysis in general security where speed is critical.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk