We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2c44f77 commit 1972de9Copy full SHA for 1972de9
1 file changed
FastImageCache/FICImageTable.m
@@ -257,7 +257,11 @@ - (void)setEntryForEntityUUID:(NSString *)entityUUID sourceImageUUID:(NSString *
257
newEntryIndex = [self _nextEntryIndex];
258
259
if (newEntryIndex >= _entryCount) {
260
- NSInteger newEntryCount = _entryCount + MAX(_entriesPerChunk, newEntryIndex - _entryCount + 1);
+ // Determine how many chunks we need to support new entry index.
261
+ // Number of entries should always be a multiple of _entriesPerChunk
262
+ NSInteger numberOfEntriesRequired = newEntryIndex + 1;
263
+ NSInteger newChunkCount = _entriesPerChunk > 0 ? ((numberOfEntriesRequired + _entriesPerChunk - 1) / _entriesPerChunk) : 0;
264
+ NSInteger newEntryCount = newChunkCount * _entriesPerChunk;
265
[self _setEntryCount:newEntryCount];
266
}
267
0 commit comments