qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v4 2/2] util/oslib: Assert qemu_try_memalign() alignment is a


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v4 2/2] util/oslib: Assert qemu_try_memalign() alignment is a power of 2
Date: Wed, 21 Oct 2020 18:21:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

On 10/21/20 6:01 PM, Richard Henderson wrote:
On 10/20/20 4:17 AM, Philippe Mathieu-Daudé wrote:
@@ -200,6 +200,9 @@ void *qemu_try_memalign(size_t alignment, size_t size)
if (alignment < sizeof(void*)) {
          alignment = sizeof(void*);
+    } else {
+        g_assert(QEMU_IS_ALIGNED(alignment, sizeof(void *)));

This is redundant with the if above, and the assert below.

Indeed, thanks =)


+        g_assert(is_power_of_2(alignment));


r~





reply via email to

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