<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/121353>121353</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy: `cppcoreguidelines-pro-bounds-constant-array-index`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          root-kidik
      </td>
    </tr>
</table>

<pre>
    ## Description
```cpp
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-constant-array-index)
crc = (crc >> kProtocolShiftCount) ^ kCrc32Tab[crc & constants::kPreamble];
``` 
Why do we need to disable this check here (don't use kCrc32Tab.at())?
1. `constants::kPreamble` == `255`
2. `crc` == `any number` & `constants::kPreamble` <= 255 - always, the laws of mathematics have not been repealed
3. `kCrc32Tab.size()` == `256`, therefore the `maximum index` == `255`
Conclusion: therefore this expression will always be within the array boundaries

## Proposal

Improve `clang-tidy` so that it understands such patterns and does not give a warning
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVN2K6zYQfhr5ZnCQpciJL3zhzQ8sHLYLXWhvZWkSq5ElI8nJpk9f5OSw55SWUjDYljzfz-gbyxjN2SG2RLwQsS_knAYf2uB9Ki9Gm0vRe31vCeOEcdhjVMFMyXhHaEdq-rjUNOVXdiTsCG-_fHt9-3g7_P7x7fXtQNhWTZPyAc-z0WiNw1hOwZe9n52OpfIuJulSKUOQ99I4jZ-ENYR2KiggfA8ZYXk8EH6Ay3vwyStvfx3MKe387BJhDRBxgMsuKM4-ZE_Ey1LBavgOHwnvCO8u7wHl2FskYk_4y48egNDut-EO2sMNwSFqSB60ibK3CGkwEdSA6gIDBsyitHeEbRLMEb-oVzIRts0GWEP4kdCuWkHu0L_pyMR8v_isKRMii6EdexQF9fO-dHdw89hjWNZZ_d_Qu1zKhIASpL3JeyRsB2lAsPIWwZ9glGnAUSajIgzyiuB8gh7RQcAJpUVNaMcXPV8uo_kTnz7_ZqDOBh4UAU8-4EJGajrKTzPOIzxO-J9t77xTdo45Xbz7CcJEwM8pYMybcDPWPu1Aj3AzaTBuIVpSBEu2ZDAY8wnnZC7pfQ9-8lHax-LrOAV_XbQpK925TEbfs7DoIQ0ygUkwO40hd1dHiLMaYJIpYXARpNOgPcalXWdzRZBwk8EZdy50y3XDG1lgW224ENt1Q5tiaNdNtTnxk5Z6K_qKKVk3Vb3hTbNZr9V2rQvTMsrWFeO02gpBm9VWNKcNPfG-R6E3FMma4iiNXVl7HVc-nAsT44xtxSoueGFljzZ-H-XQ5q_Kfj5HsqbWxBS_6pJJFtsfjPMOHpP8P2e1psUcbDukNC0JXH4CZ5OGuV8pPxJ2zJzPW0b7A1Ui7LgIj4Qdn9qvLfsrAAD__3orbMQ">