summaryrefslogtreecommitdiff
path: root/lib/utils/cppc
diff options
context:
space:
mode:
authorSamuel Holland <[email protected]>2025-02-20 10:42:28 -0800
committerAnup Patel <[email protected]>2025-03-24 17:56:05 +0530
commit6b97950cf5d51afcfd8d059a0d8baa15601e55ab (patch)
tree05c16a6d5bf7ea315775c830536639111b4868ed /lib/utils/cppc
parentef4ed2dda76648171d551537443a16b5db712284 (diff)
lib: sbi_scratch: Optimize hartid and scratch lookup
The compiler generates much better code for sbi_hartindex_to_hartid() and sbi_hartindex_to_scratch() when using a constant for the bounds check. This works out nicely because the underlying arrays are already a constant size, so the only change needed is to fill the remainder of each array with the appropriate default/out-of-bounds value. The ellipsis in the designated initializer is a GCC extension (also supported by Clang), but avoids runtime initialization of the array. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib/utils/cppc')
0 files changed, 0 insertions, 0 deletions