https://git.reactos.org/?p=reactos.git;a=commitdiff;h=26fe3616fe2fe35e41deedb92f75f9cf2ec266f9

commit 26fe3616fe2fe35e41deedb92f75f9cf2ec266f9
Author:     George Bișoc <george.bi...@reactos.org>
AuthorDate: Mon Aug 28 19:37:00 2023 +0200
Commit:     George Bișoc <george.bi...@reactos.org>
CommitDate: Sun Oct 1 20:06:00 2023 +0200

    [NTOS:CM] Implement COMPUTE_HASH_CHAR macro definition
    
    Wrap the hash computation formula in a macro so that we don't have to copy
    the logic over the places again and again.
---
 ntoskrnl/include/internal/cm_x.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ntoskrnl/include/internal/cm_x.h b/ntoskrnl/include/internal/cm_x.h
index b9e561952c3..daf7d67643b 100644
--- a/ntoskrnl/include/internal/cm_x.h
+++ b/ntoskrnl/include/internal/cm_x.h
@@ -12,6 +12,12 @@
 #define GET_HASH_KEY(ConvKey)                                       \
     ((CMP_HASH_IRRATIONAL * (ConvKey)) % CMP_HASH_PRIME)
 
+//
+// Computes the hashkey of a character
+//
+#define COMPUTE_HASH_CHAR(ConvKey, Char)                            \
+    (37 * ConvKey + RtlUpcaseUnicodeChar(Char))
+
 //
 // Returns the index into the hash table, or the entry itself
 //

Reply via email to