emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/xelb 3d8a7fe: Minor fix for the sequence number compari


From: Chris Feng
Subject: [elpa] externals/xelb 3d8a7fe: Minor fix for the sequence number comparison function
Date: Fri, 06 Nov 2015 05:40:55 +0000

branch: externals/xelb
commit 3d8a7fe1c3ab9004bd7c13be678512d78fd4f380
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>

    Minor fix for the sequence number comparison function
    
    * xcb.el (xcb:-sequence-cmp16): Return the difference of sequence numbers
      instead.
---
 xcb.el |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/xcb.el b/xcb.el
index a20253e..04d34b2 100644
--- a/xcb.el
+++ b/xcb.el
@@ -102,14 +102,14 @@
 (defsubst xcb:-sequence-cmp16 (sequence1 sequence2)
   "Compare 16-bit sequence numbers SEQUENCE1 and SEQUENCE2.
 
-Return 1 if SEQUENCE1 is larger than SEQUENCE2, 0 if they are equal, -1
-otherwise."
+Return a positive value if SEQUENCE1 is larger than SEQUENCE2, 0 if they are
+equal.  Otherwise a negative value would be returned."
   (if (= sequence1 sequence2)
       0
-    (if (< #x7FFF (abs (- sequence1 sequence2)))
-        ;; Overflowed
-        (if (< sequence1 sequence2) 1 -1)
-      (if (> sequence1 sequence2) 1 -1))))
+    (let ((diff (- sequence1 sequence2)))
+      (if (< #x7FFF (abs diff))
+          (- diff)                      ;overflowed
+        diff))))
 
 (defclass xcb:auth-info ()
   ((name :initarg :name :initform "" :type string)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]