branch: externals/websocket
commit 9aad2f754f7ce579bc5da72b3e853fb7a534c26b
Author: ahyatt <ahy...@gmail.com>
Commit: ahyatt <ahy...@gmail.com>

    Add supports for <32 bit emacs.
    
    Some emacs only have 29 bits (the minimal range).  If the emacs can’t
    compute 2^32 (the result seems to be 0 when this happens, according to
    my testing), then we’ll just use the whole val as the lower 32 bits of
    an 8 bit number to be transmitted.
---
 websocket.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/websocket.el b/websocket.el
index a96876d9d4..316bc0d1af 100644
--- a/websocket.el
+++ b/websocket.el
@@ -235,7 +235,11 @@ approximately 537M long."
   (if (= nbytes 8)
       (progn
         (let ((hi-32bits (lsh val -32))
-              (low-32bits (logand #xffffffff val)))
+              ;; Test for systems that don't have > 32 bits, and
+              ;; for those systems just return the value.
+              (low-32bits (if (= 0 (expt 2 32))
+                              val
+                            (logand #xffffffff val))))
           (when (or (> hi-32bits 0) (> (lsh low-32bits -29) 0))
             (signal 'websocket-frame-too-large val))
           (bindat-pack `((:val vec 2 u32))

Reply via email to