summaryrefslogtreecommitdiff
path: root/strings/strings_def.h
diff options
context:
space:
mode:
Diffstat (limited to 'strings/strings_def.h')
-rw-r--r--strings/strings_def.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/strings/strings_def.h b/strings/strings_def.h
index 6bd8e8f5575..d601f5ca697 100644
--- a/strings/strings_def.h
+++ b/strings/strings_def.h
@@ -100,4 +100,20 @@ static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len)
end--;
return (end);
}
+
+/* Macros for hashing characters */
+
+#define MY_HASH_ADD(A, B, value) \
+ do { A^= (((A & 63)+B)*((value)))+ (A << 8); B+=3; } while(0)
+
+#define MY_HASH_ADD_16(A, B, value) \
+ do { MY_HASH_ADD(A, B, ((value) & 0xFF)) ; MY_HASH_ADD(A, B, ((value >>8 ))); } while(0)
+
+/*
+ This one is needed to ensure we get the exact same hash as MariaDB 5.1
+ This is needed to ensure that old partitioned tables still work as before.
+*/
+#define MY_HASH_ADD_16_INV(A, B, value) \
+ do { MY_HASH_ADD(A, B, ((value >> 8))) ; MY_HASH_ADD(A, B, ((value & 0xFF ))); } while(0)
+
#endif