]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/unicode/stringtriebuilder.h
ICU-64260.0.1.tar.gz
[apple/icu.git] / icuSources / common / unicode / stringtriebuilder.h
index 423290484b9cd0122138e2e4838fc82f35533356..fc02dba6293ba3bb124c86214c71467cbcb91e91 100644 (file)
  */
 
 // Forward declaration.
  */
 
 // Forward declaration.
+/// \cond
 struct UHashtable;
 typedef struct UHashtable UHashtable;
 struct UHashtable;
 typedef struct UHashtable UHashtable;
+/// \endcond
 
 /**
  * Build options for BytesTrieBuilder and CharsTrieBuilder.
 
 /**
  * Build options for BytesTrieBuilder and CharsTrieBuilder.
@@ -65,7 +67,7 @@ class U_COMMON_API StringTrieBuilder : public UObject {
 public:
 #ifndef U_HIDE_INTERNAL_API
     /** @internal */
 public:
 #ifndef U_HIDE_INTERNAL_API
     /** @internal */
-    static UBool hashNode(const void *node);
+    static int32_t hashNode(const void *node);
     /** @internal */
     static UBool equalNodes(const void *left, const void *right);
 #endif  /* U_HIDE_INTERNAL_API */
     /** @internal */
     static UBool equalNodes(const void *left, const void *right);
 #endif  /* U_HIDE_INTERNAL_API */
@@ -189,7 +191,10 @@ protected:
 
     // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
     // it is needed for layout of other objects.
 
     // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
     // it is needed for layout of other objects.
-    /** @internal */
+    /**
+     * @internal
+     * \cond
+     */
     class Node : public UObject {
     public:
         Node(int32_t initialHash) : hash(initialHash), offset(0) {}
     class Node : public UObject {
     public:
         Node(int32_t initialHash) : hash(initialHash), offset(0) {}
@@ -257,7 +262,7 @@ protected:
     /** @internal */
     class FinalValueNode : public Node {
     public:
     /** @internal */
     class FinalValueNode : public Node {
     public:
-        FinalValueNode(int32_t v) : Node(0x111111*37+v), value(v) {}
+        FinalValueNode(int32_t v) : Node(0x111111u*37u+v), value(v) {}
         virtual UBool operator==(const Node &other) const;
         virtual void write(StringTrieBuilder &builder);
     protected:
         virtual UBool operator==(const Node &other) const;
         virtual void write(StringTrieBuilder &builder);
     protected:
@@ -277,7 +282,7 @@ protected:
         void setValue(int32_t v) {
             hasValue=TRUE;
             value=v;
         void setValue(int32_t v) {
             hasValue=TRUE;
             value=v;
-            hash=hash*37+v;
+            hash=hash*37u+v;
         }
     protected:
         UBool hasValue;
         }
     protected:
         UBool hasValue;
@@ -291,7 +296,7 @@ protected:
     class IntermediateValueNode : public ValueNode {
     public:
         IntermediateValueNode(int32_t v, Node *nextNode)
     class IntermediateValueNode : public ValueNode {
     public:
         IntermediateValueNode(int32_t v, Node *nextNode)
-                : ValueNode(0x222222*37+hashCode(nextNode)), next(nextNode) { setValue(v); }
+                : ValueNode(0x222222u*37u+hashCode(nextNode)), next(nextNode) { setValue(v); }
         virtual UBool operator==(const Node &other) const;
         virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
         virtual void write(StringTrieBuilder &builder);
         virtual UBool operator==(const Node &other) const;
         virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
         virtual void write(StringTrieBuilder &builder);
@@ -308,7 +313,7 @@ protected:
     class LinearMatchNode : public ValueNode {
     public:
         LinearMatchNode(int32_t len, Node *nextNode)
     class LinearMatchNode : public ValueNode {
     public:
         LinearMatchNode(int32_t len, Node *nextNode)
-                : ValueNode((0x333333*37+len)*37+hashCode(nextNode)),
+                : ValueNode((0x333333u*37u+len)*37u+hashCode(nextNode)),
                   length(len), next(nextNode) {}
         virtual UBool operator==(const Node &other) const;
         virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
                   length(len), next(nextNode) {}
         virtual UBool operator==(const Node &other) const;
         virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
@@ -343,7 +348,7 @@ protected:
             equal[length]=NULL;
             values[length]=value;
             ++length;
             equal[length]=NULL;
             values[length]=value;
             ++length;
-            hash=(hash*37+c)*37+value;
+            hash=(hash*37u+c)*37u+value;
         }
         // Adds a unit which leads to another match node.
         void add(int32_t c, Node *node) {
         }
         // Adds a unit which leads to another match node.
         void add(int32_t c, Node *node) {
@@ -351,7 +356,7 @@ protected:
             equal[length]=node;
             values[length]=0;
             ++length;
             equal[length]=node;
             values[length]=0;
             ++length;
-            hash=(hash*37+c)*37+hashCode(node);
+            hash=(hash*37u+c)*37u+hashCode(node);
         }
     protected:
         Node *equal[kMaxBranchLinearSubNodeLength];  // NULL means "has final value".
         }
     protected:
         Node *equal[kMaxBranchLinearSubNodeLength];  // NULL means "has final value".
@@ -366,8 +371,8 @@ protected:
     class SplitBranchNode : public BranchNode {
     public:
         SplitBranchNode(char16_t middleUnit, Node *lessThanNode, Node *greaterOrEqualNode)
     class SplitBranchNode : public BranchNode {
     public:
         SplitBranchNode(char16_t middleUnit, Node *lessThanNode, Node *greaterOrEqualNode)
-                : BranchNode(((0x555555*37+middleUnit)*37+
-                              hashCode(lessThanNode))*37+hashCode(greaterOrEqualNode)),
+                : BranchNode(((0x555555u*37u+middleUnit)*37u+
+                              hashCode(lessThanNode))*37u+hashCode(greaterOrEqualNode)),
                   unit(middleUnit), lessThan(lessThanNode), greaterOrEqual(greaterOrEqualNode) {}
         virtual UBool operator==(const Node &other) const;
         virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
                   unit(middleUnit), lessThan(lessThanNode), greaterOrEqual(greaterOrEqualNode) {}
         virtual UBool operator==(const Node &other) const;
         virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
@@ -383,7 +388,7 @@ protected:
     class BranchHeadNode : public ValueNode {
     public:
         BranchHeadNode(int32_t len, Node *subNode)
     class BranchHeadNode : public ValueNode {
     public:
         BranchHeadNode(int32_t len, Node *subNode)
-                : ValueNode((0x666666*37+len)*37+hashCode(subNode)),
+                : ValueNode((0x666666u*37u+len)*37u+hashCode(subNode)),
                   length(len), next(subNode) {}
         virtual UBool operator==(const Node &other) const;
         virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
                   length(len), next(subNode) {}
         virtual UBool operator==(const Node &other) const;
         virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
@@ -392,7 +397,9 @@ protected:
         int32_t length;
         Node *next;  // A branch sub-node.
     };
         int32_t length;
         Node *next;  // A branch sub-node.
     };
+
 #endif  /* U_HIDE_INTERNAL_API */
 #endif  /* U_HIDE_INTERNAL_API */
+    /// \endcond
 
     /** @internal */
     virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length,
 
     /** @internal */
     virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length,