]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: include: move SWAP/MID_RANGE/MAX_RANGE from tools.h to standard.h
authorWilly Tarreau <w@1wt.eu>
Wed, 3 Jun 2020 15:49:00 +0000 (17:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Jun 2020 08:18:56 +0000 (10:18 +0200)
Tools.h doesn't make sense for these 3 macros alone anymore, let's move
them to standard.h which will ultimately become again tools.h once moved.

include/common/standard.h
include/common/tools.h

index fdbfc48a9cd916367005e69fed2242e8824fcf35..2f1dffe36c7d1da07910039761785c1bb6c7abce 100644 (file)
  * power of 2, and 0 otherwise */
 #define POWEROF2(x) (((x) & ((x)-1)) == 0)
 
+#define SWAP(a, b) do { typeof(a) t; t = a; a = b; b = t; } while(0)
+
+/* return an integer of type <ret> with only the highest bit set. <ret> may be
+ * both a variable or a type.
+ */
+#define MID_RANGE(ret) ((typeof(ret))1 << (8*sizeof(ret) - 1))
+
+/* return the largest possible integer of type <ret>, with all bits set */
+#define MAX_RANGE(ret) (~(typeof(ret))0)
+
 /* rotate left a 64-bit integer by <bits:[0-5]> bits */
 static inline uint64_t rotl64(uint64_t v, uint8_t bits)
 {
index 8db38c6b45eefc72179f8b7ff24e8b4118d3b019..e663ec2e755e876ad5d00d17df8c704d9bc6aacd 100644 (file)
 #ifndef _COMMON_TOOLS_H
 #define _COMMON_TOOLS_H
 
-#define SWAP(a, b) do { typeof(a) t; t = a; a = b; b = t; } while(0)
-
-/* return an integer of type <ret> with only the highest bit set. <ret> may be
- * both a variable or a type.
- */
-#define MID_RANGE(ret) ((typeof(ret))1 << (8*sizeof(ret) - 1))
-
-/* return the largest possible integer of type <ret>, with all bits set */
-#define MAX_RANGE(ret) (~(typeof(ret))0)
-
 #endif /* _COMMON_TOOLS_H */
 
 /*