From db20d02fc00af891a7a0ec9c3acab35ab8856a9c Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Thu, 27 Feb 2025 14:37:32 +0000 Subject: [PATCH] Use alignment information properly --- Source/ObjectiveC2/weak.m | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Source/ObjectiveC2/weak.m b/Source/ObjectiveC2/weak.m index 47fcc6736..64e1efb90 100644 --- a/Source/ObjectiveC2/weak.m +++ b/Source/ObjectiveC2/weak.m @@ -34,14 +34,8 @@ isPersistentObject(id obj) * pointer (to the class of the object) then the object must be a * special one of some sort and we assume it's persistent. */ -#if ALIGNOF_OBJC_OBJECT == 8 - if ((intptr_t)obj & 7) - { - return YES; - } -#endif -#if ALIGNOF_OBJC_OBJECT == 4 - if ((intptr_t)obj & 3) +#if ALIGNOF_OBJC_OBJECT > 1 + if ((intptr_t)obj & (ALIGNOF_OBJC_OBJECT - 1)) { return YES; }