Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.lisp > #60729
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Aidan Kehoe <kehoea@parhasard.net> |
| Newsgroups | comp.lang.lisp |
| Subject | Re: the unsigned right shift operator in CL >>> |
| Date | Thu, 16 Oct 2025 21:55:26 +0100 |
| Lines | 34 |
| Message-ID | <87jz0utvlt.fsf@parhasard.net> (permalink) |
| References | <m3ms5s3atl.fsf@pison.robolove.meer.net> <87wm4uu3j6.fsf@parhasard.net> <86tszy392o.fsf@williamsburg.bawden.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net ESIG5I7Ts7cfEnbaYFF/KgqPttTQktql0uofjlQ85IyZpPe82U |
| Cancel-Lock | sha1:9QAlBuPYZ08KmhP2y1K2o2EJXsc= sha1:ODZiyGCGNX+BNnXmZI7FFgRSU/8= sha256:o57+5wONNd+OKmVidaFRa+A10rZeomihiMy9Y0h4LI8= |
| User-Agent | Gnus/5.101 (Gnus v5.10.10) XEmacs/21.5-b35 (Linux-aarch64) |
| Xref | csiph.com comp.lang.lisp:60729 |
Show key headers only | View raw
Ar an séú lá déag de mí Deireadh Fómhair, scríobh Alan Bawden: > Aidan Kehoe <kehoea@parhasard.net> writes: > > Ar an cúigiú lá déag de mí Deireadh Fómhair, scríobh Madhu: > > Something like: > > (defun fixed-width-ash (width value count) > (ash (logand value (lognot (ash -1 width))) count)) To comment on my own code; this won’t do the desired fixed-width treatment of COUNT is positive, the logand would need to be done on the result of the #'ash. But the discussion was about implementing >>>, where COUNT is negative. > Construct an integer of the desired width that is all 1s, logand it > with VALUE, then shift by COUNT. > > Your compiler will probably recognize that this is equivalent to: > > (defun fixed-width-ash (width value count) > (ash (logandc2 value (ash -1 width)) count)) > > But I would write it that way in the first place because I like to > remember that the PDP-10 had an ANDCM instruction... I don’t expect to remember any other PDP-10 instructions, but I might remember this one. Thanks! -- ‘As I sat looking up at the Guinness ad, I could never figure out / How your man stayed up on the surfboard after fourteen pints of stout’ (C. Moore)
Back to comp.lang.lisp | Previous | Next — Previous in thread | Next in thread | Find similar
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