[Insight-developers] Help to debug on LInux64 and Mac 10.5
Sean McBride
sean at rogue-research.com
Thu Dec 20 16:05:51 EST 2007
On 12/20/07 1:52 PM, Bill Lorensen said:
>Can you add some output to the Algorithms/itkStructHashFunction.h to
>std::cout the key, len and hash? Then run the Review test.
Bill,
Mathieu and I looked at it more... I think this hash function is
definitely involved in the problem. I added:
template< class TInput >
inline unsigned int
StructHashFunction< TInput >
::operator()( const InputType& key ) const
{
size_t len = sizeof( InputType );
std::cout << "key is: " << key << std::endl;
std::cout << "key size: " << std::dec << len << std::endl;
First, "key" prints itself as, for example, "[0, 1, 0]". "key size" is
32 bytes. Is this expected? I would have thought 3 * sizeof(float/
double) which is either 12 or 24. I guess the vtable or other members
of the class take up space too. Indeed, a "FixedArray" contains some
pointer-sized members, and so the size is probably different on 32/64
builds. If so, then different hashes will be computed and collisions
may result? Does it make sense to be hashing against private things
anyway? Seems to go against the comment at the top of
itkStructHashFunction.h.
Thoughts?
--
____________________________________________________________
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the Insight-developers
mailing list