qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v4 06/18] plugins: define qemu_plugin_u64


From: Richard Henderson
Subject: Re: [PATCH v4 06/18] plugins: define qemu_plugin_u64
Date: Tue, 13 Feb 2024 08:29:58 -1000
User-agent: Mozilla Thunderbird

On 2/12/24 23:39, Pierrick Bouvier wrote:
+uint64_t qemu_plugin_u64_sum(qemu_plugin_u64 entry)
+{
+    uint64_t total = 0;
+    for (int i = 0; i < qemu_plugin_num_vcpus(); ++i) {
+        total += qemu_plugin_u64_get(entry, i);
+    }

Avoid complex loop bounds whenever possible.

  for (int i = 0, n = qemu_plugin_num_vcpus(); i < n; ++i)

or

  for (int i = qemu_plugin_num_vcpus() - 1; i >= 0; --i)

With that,

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~



reply via email to

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