emacs-exwm / xelb

X protocol Emacs Lisp Binding
https://elpa.gnu.org/packages/xelb.html
GNU General Public License v3.0
27 stars 5 forks source link

lsh -> ash compilation warnings #1

Closed minad closed 9 months ago

minad commented 9 months ago

The Emacs byte compiler warns about the usage of lsh. It suggests the function ash as alternative, which is subtly different. We should check this and use ash if possible. cc @Stebalien

Stebalien commented 9 months ago

I think upstream's point here is that you shouldn't treat negative numbers as unsigned integers. Looking through the code... I think we can safely use ash.

minad commented 9 months ago

Yes. For signed integers there are even functions performing an additional two's complement:

(defsubst xcb:-pack-i2 (value)
  "2 bytes signed integer => byte array (MSB first)."
  (xcb:-pack-u2 (if (>= value 0) value
                  (1+ (logand #xFFFF (lognot (- value)))))))
medranocalvo commented 9 months ago

I worked on this and have something half backed. Give me a few days. Am 13.01.2024 um 20:56 schrieb Daniel Mendler @.***>: Yes. For signed integers there are even functions performing an additional two complement: (defsubst xcb:-pack-i2 (value) "2 bytes signed integer => byte array (MSB first)." (xcb:-pack-u2 (if (>= value 0) value (1+ (logand #xFFFF (lognot (- value)))))))

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

minad commented 9 months ago

medranocalvo @.***> writes:

I worked on this and have something half backed. Give me a few days.

Perfect, thanks!