+ while (str_len--) {
+ hash += (*str) * (*str);
+ str++;
+ }
+#endif
+
+ return hash;
+}
+
+/**
+ * @brief Returns the hash code of a string.
+ */
+static inline unsigned int xbt_str_hash(const char *str)
+{
+#ifdef DJB2_HASH_FUNCTION
+ /* fast implementation of djb2 algorithm */
+ int c;
+ unsigned int hash = 5381;
+
+ while ((c = *str++)) {
+ hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
+ }
+
+# elif defined(FNV_HASH_FUNCTION)
+ unsigned int hash = 0x811c9dc5;
+
+ while (*str) {
+ /* multiply by the 32 bit FNV magic prime mod 2^32 */
+ hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);
+
+ /* xor the bottom with the current byte */
+ hash ^= (unsigned int) *str++;
+ }
+
+# else
+ unsigned int hash = 0;
+
+ while (*str) {
+ hash += (*str) * (*str);
+ str++;
+ }
+#endif
+ return hash;
+}
+
+/**@}*/