]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix missing ast_test_flag64 in extconf.c
authorArtem Umerov <artem1999.umerov@gmail.com>
Thu, 28 Aug 2025 21:43:11 +0000 (00:43 +0300)
committerAsterisk Development Team <asteriskteam@digium.com>
Wed, 10 Sep 2025 20:18:53 +0000 (20:18 +0000)
Fix missing ast_test_flag64 after https://github.com/asterisk/asterisk/commit/43bf8a4ded7a65203b766b91eaf8331a600e9d8d

(cherry picked from commit 387aad4348c4af0d52d301c3e8a6537d35502c69)

utils/extconf.c

index c11ad4fa2efbfa037ebb993af1c055e320f6dff7..b1ec22e063a49c4a1c33df317d5d3e944515bc34 100644 (file)
@@ -674,22 +674,20 @@ int ast_channel_trylock(struct ast_channel *chan);
 struct ast_flags {  /* stolen from utils.h */
        unsigned int flags;
 };
-#define ast_test_flag(p,flag)          ({ \
-                                       typeof ((p)->flags) __p = (p)->flags; \
-                                       unsigned int __x = 0; \
-                                       (void) (&__p == &__x); \
-                                       ((p)->flags & (flag)); \
-                                       })
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define SWAP64_32(flags) (((uint64_t)flags << 32) | ((uint64_t)flags >> 32))
+#else
+#define SWAP64_32(flags) (flags)
+#endif
+
+extern uint64_t __unsigned_int_flags_dummy64;
 
-#define ast_set2_flag(p,value,flag)    do { \
+#define ast_test_flag64(p,flag)                ({ \
                                        typeof ((p)->flags) __p = (p)->flags; \
-                                       unsigned int __x = 0; \
+                                       typeof (__unsigned_int_flags_dummy64) __x = 0; \
                                        (void) (&__p == &__x); \
-                                       if (value) \
-                                               (p)->flags |= (flag); \
-                                       else \
-                                               (p)->flags &= ~(flag); \
-                                       } while (0)
+                                       ((p)->flags & SWAP64_32(flag)); \
+                                       })
 
 /* from config.c */