slot method

int slot(
  1. int set,
  2. int way
)

Converts a set/way pair into a flattened slot.

Implementation

int slot(int set, int way) {
  if (set < 0 || set >= setCount || way < 0 || way >= wayCount) {
    throw RangeError('Set/way pair is outside cache geometry.');
  }
  return set * wayCount + way;
}