Closed minad closed 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
.
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)))))))
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: @.***>
medranocalvo @.***> writes:
I worked on this and have something half backed. Give me a few days.
Perfect, thanks!
The Emacs byte compiler warns about the usage of
lsh
. It suggests the functionash
as alternative, which is subtly different. We should check this and useash
if possible. cc @Stebalien