@@ -207,10 +207,10 @@ func (idx *MemoryIndex) genOffsetHash() error {
207
207
var hash plumbing.Hash
208
208
i := uint32 (0 )
209
209
for firstLevel , fanoutValue := range idx .Fanout {
210
- pos := idx .FanoutMapping [firstLevel ]
210
+ mappedFirstLevel := idx .FanoutMapping [firstLevel ]
211
211
for secondLevel := uint32 (0 ); i < fanoutValue ; i ++ {
212
- copy (hash [:], idx .Names [pos ][secondLevel * objectIDLength :])
213
- offset := int64 (idx .getOffset (pos , int (secondLevel )))
212
+ copy (hash [:], idx .Names [mappedFirstLevel ][secondLevel * objectIDLength :])
213
+ offset := int64 (idx .getOffset (mappedFirstLevel , int (secondLevel )))
214
214
idx .offsetHash [offset ] = hash
215
215
secondLevel ++
216
216
}
@@ -285,14 +285,11 @@ func (i *idxfileEntryIter) Next() (*Entry, error) {
285
285
continue
286
286
}
287
287
288
+ mappedFirstLevel := i .idx .FanoutMapping [i .firstLevel ]
288
289
entry := new (Entry )
289
- ofs := i .secondLevel * objectIDLength
290
- copy (entry .Hash [:], i .idx .Names [i .idx .FanoutMapping [i .firstLevel ]][ofs :])
291
-
292
- pos := i .idx .FanoutMapping [entry .Hash [0 ]]
293
-
294
- entry .Offset = i .idx .getOffset (pos , i .secondLevel )
295
- entry .CRC32 = i .idx .getCRC32 (pos , i .secondLevel )
290
+ copy (entry .Hash [:], i .idx .Names [mappedFirstLevel ][i .secondLevel * objectIDLength :])
291
+ entry .Offset = i .idx .getOffset (mappedFirstLevel , i .secondLevel )
292
+ entry .CRC32 = i .idx .getCRC32 (mappedFirstLevel , i .secondLevel )
296
293
297
294
i .secondLevel ++
298
295
i .total ++
0 commit comments