xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 13 22:18:53 UTC 2025
Xext/sync.c | 29 -----------------------------
include/misc.h | 29 +++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 29 deletions(-)
New commits:
commit cd583932a1154215e1f7b94db5d3fe5e22baa732
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Wed Jun 11 14:44:18 2025 -0700
Revert "misc.h: move out checked_int64_(add|subtract)"
This reverts commit de0aed054395513498fb8b0acee778f48ff18242
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2014>
diff --git a/Xext/sync.c b/Xext/sync.c
index cab73be92..0ee4a8130 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -312,35 +312,6 @@ SyncCheckTriggerFence(SyncTrigger * pTrigger, int64_t unused)
return (pFence == NULL || pFence->funcs.CheckTriggered(pFence));
}
-static inline Bool
-checked_int64_add(int64_t *out, int64_t a, int64_t b)
-{
- /* Do the potentially overflowing math as uint64_t, as signed
- * integers in C are undefined on overflow (and the compiler may
- * optimize out our overflow check below, otherwise)
- */
- int64_t result = (uint64_t)a + (uint64_t)b;
- /* signed addition overflows if operands have the same sign, and
- * the sign of the result doesn't match the sign of the inputs.
- */
- Bool overflow = (a < 0) == (b < 0) && (a < 0) != (result < 0);
-
- *out = result;
-
- return overflow;
-}
-
-static inline Bool
-checked_int64_subtract(int64_t *out, int64_t a, int64_t b)
-{
- int64_t result = (uint64_t)a - (uint64_t)b;
- Bool overflow = (a < 0) != (b < 0) && (a < 0) != (result < 0);
-
- *out = result;
-
- return overflow;
-}
-
static int
SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
RESTYPE resType, Mask changes)
diff --git a/include/misc.h b/include/misc.h
index 36554fa3c..a6b54389e 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -285,6 +285,35 @@ bswap_32(uint32_t x)
((x & 0x000000FF) << 24));
}
+static inline Bool
+checked_int64_add(int64_t *out, int64_t a, int64_t b)
+{
+ /* Do the potentially overflowing math as uint64_t, as signed
+ * integers in C are undefined on overflow (and the compiler may
+ * optimize out our overflow check below, otherwise)
+ */
+ int64_t result = (uint64_t)a + (uint64_t)b;
+ /* signed addition overflows if operands have the same sign, and
+ * the sign of the result doesn't match the sign of the inputs.
+ */
+ Bool overflow = (a < 0) == (b < 0) && (a < 0) != (result < 0);
+
+ *out = result;
+
+ return overflow;
+}
+
+static inline Bool
+checked_int64_subtract(int64_t *out, int64_t a, int64_t b)
+{
+ int64_t result = (uint64_t)a - (uint64_t)b;
+ Bool overflow = (a < 0) != (b < 0) && (a < 0) != (result < 0);
+
+ *out = result;
+
+ return overflow;
+}
+
#define swapl(x) do { \
if (sizeof(*(x)) != 4) \
wrong_size(); \
More information about the xorg-commit
mailing list