New generic hash function (lang maintainers)

Olivier J. G. olivier.jg at gmail.com
Tue Mar 19 06:54:57 UTC 2013


I just added /language/platform/kdevhash.h to KDevPlatform. You can see how
it's used in the various KDevplatform types' hash() function.
It's meant to provide a generic hash so you don't have to pull numbers out
of a hat for your hash and hope they don't clash, and should behave
generally pretty well.
The only only thing to beware of is that adding zero doesn't modify the
hash value, so if you have a list of items that contribute to the hash,
some of which may contribute a zero for whatever reason, make sure just to
add << list.count() to the hash as well, to make sure you don't have some
accidental clashes on items that are the same except that one has one more
zero-contributing item than the other.

-Olivier JG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20130319/994a1070/attachment-0001.html>


More information about the KDevelop-devel mailing list