From 152241f26c821f1ab6c72e01b9c3334df451b8e1 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sun, 19 Dec 2021 16:44:37 +0100
Subject: [PATCH] Don't rely on (actually changed) unspecified compiler
behavior.
---
libsrc/common/pmemalign.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libsrc/common/pmemalign.c b/libsrc/common/pmemalign.c
index 8f055a3fc..d9d6b4e97 100644
--- a/libsrc/common/pmemalign.c
+++ b/libsrc/common/pmemalign.c
@@ -75,7 +75,7 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size)
}
/* Test alignment: is it a power of two? There must be only one bit set. */
- if (alignment == 0 || (alignment & --alignment) != 0) {
+ if (alignment == 0 || (alignment & alignment - 1) != 0) {
*memptr = NULL;
return EINVAL;
}