qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/6] target/microblaze: Use the IEC binary prefix definitions


From: Richard Henderson
Subject: Re: [PATCH 1/6] target/microblaze: Use the IEC binary prefix definitions
Date: Thu, 3 Jun 2021 09:34:28 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

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 <richard.henderson@linaro.org>


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]