summaryrefslogtreecommitdiff
path: root/src/common/szbin.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2025-05-21 19:53:39 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2025-05-21 19:53:39 (GMT)
commit0df6ab6d81a9f8de884aa8283d5c060ab1f7067e (patch)
tree0521a6f5ca3c6720349c358224ceabc5868d70d3 /src/common/szbin.h
parent8dbf9b344bb90dedbd42f93c67d28d76944dccbb (diff)
Improve sized binary comparison.
Diffstat (limited to 'src/common/szbin.h')
-rw-r--r--src/common/szbin.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/common/szbin.h b/src/common/szbin.h
index 182739a..8524ae3 100644
--- a/src/common/szbin.h
+++ b/src/common/szbin.h
@@ -143,15 +143,13 @@ typedef struct _sized_binary_t
while (0)
-#define memcmp_sized_binary(s1, s2) \
- ({ \
- int __ret; \
- size_t __n; \
- __n = (s1)->size < (s2)->size ? (s1)->size : (s2)->size; \
- __ret = memcmp((s1)->data, (s2)->data, __n); \
- if (__ret == 0) \
- __ret = sort_unsigned_long_long((s1)->size, (s2)->size);\
- __ret; \
+#define memcmp_sized_binary(s1, s2) \
+ ({ \
+ int __ret; \
+ __ret = sort_size((s1)->size, (s2)->size); \
+ if (__ret == 0) \
+ __ret = memcmp((s1)->data, (s2)->data, (s1)->size); \
+ __ret; \
})