From: Andrzej Hajda <andrzej.hajda@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>,
Nirmoy Das <nirmoy.das@intel.com>
Subject: [igt-dev] [PATCH 1/2] lib/igt_aux: fix roundup_power_of_two implementation
Date: Thu, 26 Oct 2023 17:50:29 +0200 [thread overview]
Message-ID: <20231026-gtt_size_fix-v1-1-882d0e0022ec@intel.com> (raw)
In-Reply-To: <20231026-gtt_size_fix-v1-0-882d0e0022ec@intel.com>
For arguments greater than (1<<31) 64bit value must
be shifted, otherwise the result is incorrect.
Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
---
lib/igt_aux.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index fb76b031318..4d887045af7 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -329,7 +329,7 @@ void pipewire_pulse_stop_reserve(void);
64 - __builtin_clzll(x), \
32 - __builtin_clz(x)) : 0)
-#define roundup_power_of_two(x) ((x) != 0 ? 1 << igt_fls((x) - 1) : 0)
+#define roundup_power_of_two(x) ((x) != 0 ? 1ULL << igt_fls((x) - 1) : 0)
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
--
2.34.1
next prev parent reply other threads:[~2023-10-26 15:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-26 15:50 [igt-dev] [PATCH 0/2] lib/intel_batchbuffer: allow GTT size be not power of 2 Andrzej Hajda
2023-10-26 15:50 ` Andrzej Hajda [this message]
2023-10-27 9:01 ` [igt-dev] [PATCH 1/2] lib/igt_aux: fix roundup_power_of_two implementation Kamil Konieczny
2023-10-26 15:50 ` [igt-dev] [PATCH 2/2] lib/intel_batchbuffer: allow GTT size be not power of 2 Andrzej Hajda
2023-10-27 9:04 ` Kamil Konieczny
2023-10-26 18:33 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-10-26 18:39 ` [igt-dev] ✓ CI.xeBAT: " Patchwork
2023-10-27 8:18 ` [igt-dev] [PATCH 0/2] " Nirmoy Das
2023-10-28 3:21 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork
2023-10-30 8:25 ` Andrzej Hajda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231026-gtt_size_fix-v1-1-882d0e0022ec@intel.com \
--to=andrzej.hajda@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jonathan.cavitt@intel.com \
--cc=nirmoy.das@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox