Solidity does the derivation of slot under the hood when trying to access a value in an array or a mapping.
Users may want to do te same to compute slots for transient storage, which solidity does not support yet.
This library does exactly that.
See it used here