Subject: Re: bug#56641: Deprecate `lsh`

From: Mattias Engdegård <[email-masked]>
Date: Wed, 20 Jul 2022 16:30:25 +0200

20 juli 2022 kl. 14.21 skrev Po Lu <[email-masked]>:

> So you're saying there is no possible use for expecting the value of
> this:
> 
>  (lsh most-negative-fixnum -1)
> 
> to become:
> 
>  #x1000000000000000

That is only true when Emacs has been built for 62-bit fixnums. And no, I don't see an obvious use other than for compatibility.

> What business does the byte compiler, or some idea
> of "platform independence" have in dictating that I should write extra
> code (instead of using something built-in) to implement a network
> protocol?

It sounds as if we are talking past one another. If you have a network protocol that is somehow defined in terms of the size of fixnums in a particular build of Emacs, then yes, I'd say that most people would think that your code should make that explicit.

But you certainly don't need lsh to handle arbitrary binary data; it's not even convenient. I'm not saying that you are wrong; perhaps I don't understand your needs.

We could add functions for depositing and extracting bit fields in an integer, basically encapsulating the common shift-and-mask operations. That would make bit field manipulation less error-prone without compromising speed or portability.