Groups | Search | Server Info | Login | Register


Groups > comp.lang.lisp > #60768

Re: the unsigned right shift operator in CL >>>

From Kaz Kylheku <046-301-5902@kylheku.com>
Newsgroups comp.lang.lisp
Subject Re: the unsigned right shift operator in CL >>>
Date 2026-03-16 20:14 +0000
Organization A noiseless patient Spider
Message-ID <20260316131334.995@kylheku.com> (permalink)
References (3 earlier) <87jz0utvlt.fsf@parhasard.net> <m3sef9yj49.fsf@pison.robolove.meer.net> <86plac3j8e.fsf@williamsburg.bawden.org> <20260312103158.948@kylheku.com> <jwvqzpopza8.fsf-monnier+comp.lang.lisp@gnu.org>

Show all headers | View raw


On 2026-03-12, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> So I'm looking for the logtrunc function and it's not there!
>
> Do you mean something like:
>
>     (defun logtrunc (n bits)
>       (mod n (ash 1 bits)))
>
> aka
>
>     (defun logtrunc (n bits)
>       (logand n (1- (ash 1 bits))))
>

Yes, these look equivalent to me. A compiler could recognize
these patterns and contract to a "logtrunc" operation that
operates on the representation to do the truncation directly.


-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Back to comp.lang.lisp | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

the unsigned right shift operator in CL >>> Madhu <enometh@meer.net> - 2025-10-15 12:34 +0530
  Re: the unsigned right shift operator in CL >>> Aidan Kehoe <kehoea@parhasard.net> - 2025-10-16 19:04 +0100
    Re: the unsigned right shift operator in CL >>> Alan Bawden <alan@csail.mit.edu> - 2025-10-16 16:06 -0400
      Re: the unsigned right shift operator in CL >>> Aidan Kehoe <kehoea@parhasard.net> - 2025-10-16 21:55 +0100
        Re: the unsigned right shift operator in CL >>> Madhu <enometh@meer.net> - 2025-10-23 16:34 +0530
          Re: the unsigned right shift operator in CL >>> Alan Bawden <alan@csail.mit.edu> - 2025-10-24 02:29 -0400
            Re: the unsigned right shift operator in CL >>> Madhu <enometh@meer.net> - 2025-10-25 21:00 +0530
            Re: the unsigned right shift operator in CL >>> Kaz Kylheku <046-301-5902@kylheku.com> - 2026-03-12 18:00 +0000
              Re: the unsigned right shift operator in CL >>> Stefan Monnier <monnier@iro.umontreal.ca> - 2026-03-12 16:34 -0400
                Re: the unsigned right shift operator in CL >>> Kaz Kylheku <046-301-5902@kylheku.com> - 2026-03-16 20:14 +0000
  Re: the unsigned right shift operator in CL >>> Madhu <enometh@meer.net> - 2025-10-23 16:38 +0530

csiph-web