all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: npostavs@gmail.com
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 35546@debbugs.gnu.org, Tassilo Horn <tsdh@gnu.org>
Subject: bug#35546: 27.0.50; setf return value for new alist entries is wrong
Date: Tue, 07 May 2019 10:58:13 -0400	[thread overview]
Message-ID: <85zhnyxqey.fsf@gmail.com> (raw)
In-Reply-To: <878svimlbz.fsf@web.de> (Michael Heerdegen's message of "Tue, 07 May 2019 15:43:28 +0200")

Michael Heerdegen <michael_heerdegen@web.de> writes:

> struggling with 'logand', because I don't understand what it is doing.
> Not only that "it should arguably fail when trying to set a value
> outside of the mask" as described in the file header, I also don't see
> how the used formula makes more sense than setting the place to just V.

I think the rationale goes like this:

Suppose you want to *get* the bottom 4 bits of PLACE, you do

    (logand PLACE #x0F)

    ;; Example:
    (let ((var #xABCD))
      (logand var #x0F)) ;=> #xD

Suppose you want to *set* the bottom 4 bits of PLACE, you do

    (setf (logand PLACE #x0F) VALUE)

    ;; Example:
    (let ((var #xABCD))
      (setf (logand var #x0F) 9)
      var) ;=> #xABC9







  reply	other threads:[~2019-05-07 14:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 13:49 bug#35546: 27.0.50; setf return value for new alist entries is wrong Tassilo Horn
2019-05-07 11:19 ` Michael Heerdegen
2019-05-07 13:43   ` Michael Heerdegen
2019-05-07 14:58     ` npostavs [this message]
2019-05-07 15:56       ` Michael Heerdegen
2019-05-07 16:50         ` npostavs
2020-04-12 12:26           ` Štěpán Němec
2020-04-12 12:34             ` Noam Postavsky
2020-04-12 12:47               ` Štěpán Němec
2020-04-13  1:01                 ` Michael Heerdegen
2020-08-19 10:34                   ` Lars Ingebrigtsen
2020-08-25 16:16                     ` Štěpán Němec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85zhnyxqey.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=35546@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.