Differences From Artifact [7caa69a7b0]:
- File
src/OFMapTable.m
— part of check-in
[e8473b9db8]
at
2013-03-08 22:44:07
on branch trunk
— Document the block types.
This also removes "bool *stop" from some blocks where it does not make
sense. (user: js, size: 16124) [annotate] [blame] [check-ins using]
To Artifact [9fc4f60d3b]:
- File src/OFMapTable.m — part of check-in [57a6e8ef79] at 2013-03-30 20:07:08 on branch trunk — Improve code readability. (user: js, size: 16120) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
136 137 138 139 140 141 142 | if (capacity > UINT32_MAX || capacity > UINT32_MAX / sizeof(*_buckets) || capacity > UINT32_MAX / 8) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; | | | | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | if (capacity > UINT32_MAX || capacity > UINT32_MAX / sizeof(*_buckets) || capacity > UINT32_MAX / 8) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; for (_capacity = 1; _capacity < capacity; _capacity *= 2); if (capacity * 8 / _capacity >= 6) _capacity *= 2; if (_capacity < MIN_CAPACITY) _capacity = MIN_CAPACITY; _buckets = [self allocMemoryWithSize: sizeof(*_buckets) count: _capacity]; |
︙ | ︙ | |||
297 298 299 300 301 302 303 | if (count > UINT32_MAX || count > UINT32_MAX / sizeof(*_buckets) || count > UINT32_MAX / 8) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; fullness = count * 8 / _capacity; if (fullness >= 6) | | | | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | if (count > UINT32_MAX || count > UINT32_MAX / sizeof(*_buckets) || count > UINT32_MAX / 8) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; fullness = count * 8 / _capacity; if (fullness >= 6) capacity = _capacity * 2; else if (fullness <= 1) capacity = _capacity / 2; else return; /* * Don't downsize if we have an initial capacity or if we would fall * below the minimum capacity. */ |
︙ | ︙ |