On 6/3/21 2:03 AM, Philippe Mathieu-Daudé wrote:
static unsigned int tlb_decode_size(unsigned int f)
{
static const unsigned int sizes[] = {
- 1 * 1024, 4 * 1024, 16 * 1024, 64 * 1024, 256 * 1024,
- 1 * 1024 * 1024, 4 * 1024 * 1024, 16 * 1024 * 1024
+ 1 * KiB, 4 * KiB, 16 * KiB, 64 * KiB, 256 * KiB,
+ 1 * MiB, 4 * MiB, 16 * MiB
};
assert(f < ARRAY_SIZE(sizes));
return sizes[f];
I guess this is clearer, but I'll also note that this is 4**f KiB, so could
just as well be computed by
assert(f < 8);
return KiB << (f * 2);
Either way,
Reviewed-by: Richard Henderson <[email protected]>
r~