File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -320,10 +320,7 @@ func (a *ARC) updateIfResident(key string, value any) bool {
320320// handleGhostHit processes B1/B2 hits and moves the key to T2 while adapting p.
321321func (a * ARC ) handleGhostHit (key string , value any ) bool {
322322 if ghost , ok := a .b1Idx [key ]; ok {
323- increment := a .b2 .len / arcIntMax (1 , a .b1 .len )
324- if increment < 1 {
325- increment = 1
326- }
323+ increment := max (a .b2 .len / arcIntMax (1 , a .b1 .len ), 1 )
327324
328325 a .p += increment
329326 if a .p > a .capacity {
@@ -344,10 +341,7 @@ func (a *ARC) handleGhostHit(key string, value any) bool {
344341 }
345342
346343 if ghost , ok := a .b2Idx [key ]; ok {
347- decrement := a .b1 .len / arcIntMax (1 , a .b2 .len )
348- if decrement < 1 {
349- decrement = 1
350- }
344+ decrement := max (a .b1 .len / arcIntMax (1 , a .b2 .len ), 1 )
351345
352346 a .p -= decrement
353347 if a .p < 0 {
You can’t perform that action at this time.
0 commit comments