diff options
Diffstat (limited to '')
-rw-r--r-- | CPP/Common/MyMap.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/CPP/Common/MyMap.cpp b/CPP/Common/MyMap.cpp index 923846a..0a200f0 100644 --- a/CPP/Common/MyMap.cpp +++ b/CPP/Common/MyMap.cpp | |||
@@ -76,7 +76,7 @@ bool CMap32::Set(UInt32 key, UInt32 value) | |||
76 | unsigned i = kNumBitsMax - 1; | 76 | unsigned i = kNumBitsMax - 1; |
77 | for (; GetSubBit(key, i) == GetSubBit(n.Key, i); i--); | 77 | for (; GetSubBit(key, i) == GetSubBit(n.Key, i); i--); |
78 | n.Len = (UInt16)(kNumBitsMax - (1 + i)); | 78 | n.Len = (UInt16)(kNumBitsMax - (1 + i)); |
79 | unsigned newBit = GetSubBit(key, i); | 79 | const unsigned newBit = GetSubBit(key, i); |
80 | n.Values[newBit] = value; | 80 | n.Values[newBit] = value; |
81 | n.Keys[newBit] = key; | 81 | n.Keys[newBit] = key; |
82 | return false; | 82 | return false; |
@@ -91,7 +91,7 @@ bool CMap32::Set(UInt32 key, UInt32 value) | |||
91 | bitPos -= n.Len; | 91 | bitPos -= n.Len; |
92 | if (GetSubBits(key, bitPos, n.Len) != GetSubBits(n.Key, bitPos, n.Len)) | 92 | if (GetSubBits(key, bitPos, n.Len) != GetSubBits(n.Key, bitPos, n.Len)) |
93 | { | 93 | { |
94 | unsigned i = n.Len - 1; | 94 | unsigned i = (unsigned)n.Len - 1; |
95 | for (; GetSubBit(key, bitPos + i) == GetSubBit(n.Key, bitPos + i); i--); | 95 | for (; GetSubBit(key, bitPos + i) == GetSubBit(n.Key, bitPos + i); i--); |
96 | 96 | ||
97 | CNode e2(n); | 97 | CNode e2(n); |
@@ -107,7 +107,7 @@ bool CMap32::Set(UInt32 key, UInt32 value) | |||
107 | Nodes.Add(e2); | 107 | Nodes.Add(e2); |
108 | return false; | 108 | return false; |
109 | } | 109 | } |
110 | unsigned bit = GetSubBit(key, --bitPos); | 110 | const unsigned bit = GetSubBit(key, --bitPos); |
111 | 111 | ||
112 | if (n.IsLeaf[bit]) | 112 | if (n.IsLeaf[bit]) |
113 | { | 113 | { |
@@ -121,7 +121,7 @@ bool CMap32::Set(UInt32 key, UInt32 value) | |||
121 | 121 | ||
122 | CNode e2; | 122 | CNode e2; |
123 | 123 | ||
124 | unsigned newBit = GetSubBit(key, i); | 124 | const unsigned newBit = GetSubBit(key, i); |
125 | e2.Values[newBit] = value; | 125 | e2.Values[newBit] = value; |
126 | e2.Values[1 - newBit] = n.Values[bit]; | 126 | e2.Values[1 - newBit] = n.Values[bit]; |
127 | e2.IsLeaf[newBit] = e2.IsLeaf[1 - newBit] = 1; | 127 | e2.IsLeaf[newBit] = e2.IsLeaf[1 - newBit] = 1; |