From 0d96ba2ff5a25c6cd6c66f417cc9b5f38a4308ba Mon Sep 17 00:00:00 2001 From: Andrew Hyatt Date: Sun, 22 Apr 2018 20:16:52 -0400 Subject: [PATCH] Merge fix for 32-bit emacs. Fix is from the ELPA repository, commit 42e566c946db8fc8b170a13c3bdff60cbf2807b0, by Paul Eggert. Original commit message: Port websocket to bleeding-edge 32-bit Emacs Problem reported by Stefan Monnier (Bug#31118). * packages/websocket/websocket.el (websocket-to-bytes): Do not assume that #xffffffff is a valid fixnum. --- websocket.el | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/websocket.el b/websocket.el index 77d787c..b0ba193 100644 --- a/websocket.el +++ b/websocket.el @@ -234,12 +234,9 @@ approximately 537M long." val nbytes)) (if (= nbytes 8) (progn - (let ((hi-32bits (lsh val -32)) - ;; 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)))) + (let* ((hi-32bits (lsh val -32)) + ;; This is just VAL on systems that don't have >= 32 bits. + (low-32bits (- val (lsh hi-32bits 32)))) (when (or (> hi-32bits 0) (> (lsh low-32bits -29) 0)) (signal 'websocket-frame-too-large val)) (bindat-pack `((:val vec 2 u32))