S , 2012-06-02 21:57 -0400, Geoff Hutchison rakstīja:
> I had some time to check SVN blame:
> http://openbabel.svn.sf.net/viewvc/openbabel/openbabel/trunk/include/openbabel/bitvec.h?annotate=4853
> 
> So this is from Kevin Shepherd, which makes sense because he made some 
> cleanups elsewhere in the bitvec code.
> 
> > Now the issue is if USE_64BIT_INTEGER should be dropped. I don't see it
> > documented or referenced anywhere. Does anyone know where does it come
> > from? Is user expected to set it at compile time or the compiler does it
> > automatically? On which systems it is actually used if any?
> 
> This would have been set by autoconf and now by cmake.

I grepped my source and build dir, but the only reference to it was in
bitvec.h, so I was thinking that cmake might not take care of it and
user might easily be unaware of it, hence the question.

> > So that leaves us with the runtime option. It would be possible to
> > determine the size of uint at runtime and construct appropriate
> > variables for it
> 
> I think C99 is probably well-supported now, so we could simply go with:
> 
> #include <inttypes.h>
> 
> uint32_t …

Right, it came in C++ from C and should be in most compilers now. I also
think that this is the best option. I'll write a patch for it. Only I'm
reading that inttypes.h is not available for VS2003-2008, do we need a
workaround for them? If so, maybe it is better to just define uint32_t
myself.

One more question - would it make sense to use uint64_t on 64bit
platforms? Probably not without benchmarking.

> Doing a run-time check would be a bad idea, IMHO. And as far as STL
> bitset, the bitvec type is more like a specialized vector<bool> (since
> it allows resizing) but offers some additional methods. I don't know
> how performance would compare with some of the optimized
> std::vector<bool> specialization classes. It might be worth
> benchmarking at some point.
> 
> -Geoff

I was reading that STL bitset is more optimized for performance than
std::vector<bool>, but has a limitation on fixed size and people
strongly advise against the use of std::vector<bool>. My idea was to put
bitsets in a vector in place where now is unsigned int, so the main
bitvec structure remains basically the same, but with ensured size for
vector elements. Then there would probably be possibility to implement
some of the bitvec functions using bitset operations, tough I have no
idea if it would complicate the code or would be of any benefit
otherwise. If we are using uint32_t, there might not be much to gain by
using bitset.

Yeah, to find optimal solution probably would require to write different
implementations and benchmark them for different scenarios. I might look
into this if I find time.


Reinis


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to