+
+#ifndef CPU_ALLOW_UNALIGNED
+uns
+str_len(const char *str)
+{
+ uns shift = UNALIGNED_PART(str, uns);
+ if (!shift)
+ return str_len_aligned(str);
+ else
+ {
+ uns i;
+ shift = sizeof(uns) - shift;
+ for (i=0; i<shift; i++)
+ if (!str[i])
+ return i;
+ return shift + str_len_aligned(str + shift);
+ }
+}
+
+uns
+str_hash(const char *str)
+{
+ uns shift = UNALIGNED_PART(str, uns);
+ if (!shift)
+ return str_hash_aligned(str);
+ else
+ {
+ uns hash = 0;
+ uns i;
+ for (i=0; ; i++)
+ {
+ uns modulo = i % sizeof(uns);
+ uns shift;
+#ifdef CPU_LITTLE_ENDIAN
+ shift = modulo;
+#else
+ shift = sizeof(uns) - 1 - modulo;
+#endif
+ if (!modulo)
+ hash = ROL(hash, SHIFT_BITS);
+ if (!str[i])
+ break;
+ hash ^= ((unsigned char) str[i]) << (shift * 8);
+ }
+ return hash;
+ }
+}
+#endif