Parcourir la source

[2218] add suggested comment about the rationale of uint32_t for node_count_.

JINMEI Tatuya il y a 12 ans
Parent
commit
40d4887c7d
1 fichiers modifiés avec 8 ajouts et 1 suppressions
  1. 8 1
      src/lib/datasrc/memory/domaintree.h

+ 8 - 1
src/lib/datasrc/memory/domaintree.h

@@ -1446,8 +1446,15 @@ private:
     //@}
 
     typename DomainTreeNode<T>::DomainTreeNodePtr root_;
-    /// the node count of current tree
+
+    /// the node count of current tree.
+    ///
+    /// Note: uint32_t may look awkward, but we intentionally choose it so
+    /// that needsReturnEmptyNode_ below won't make cause extra padding
+    /// in 64-bit machines (and we can minimize the total size of this class).
+    /// 2^32 - 1 should be a reasonable max of possible number of nodes.
     uint32_t node_count_;
+
     /// search policy for domaintree
     const bool needsReturnEmptyNode_;
 };