unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17475: 24.3.91; bug of byte-optimize-zerop
@ 2014-05-12 15:11 Shigeru Fukaya
  2014-05-16 21:11 ` Shigeru Fukaya
  0 siblings, 1 reply; 4+ messages in thread
From: Shigeru Fukaya @ 2014-05-12 15:11 UTC (permalink / raw)
  To: 17475

`byte-optimize-zerop' is badly implemented.  Even when
`byte-compile-delete-errors' is non-nil, bute-compiled code may
signal an error.
(= FORM 0) and (zerop FORM) are functionally equal, besides, the
former is better when byte-compiled.

The following is the poor alternative.
I can't make a smart code without creating a new function.

(defun byte-optimize-zerop (form)
  (cond ((numberp (nth 1 form))
         (eval form))
        (byte-compile-delete-errors
         `(and (member ,(nth 1 form) (quote 0 0.0))) t)
        ((list '= (nth 1 form) 0))))

-- Shigeru





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-28  0:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12 15:11 bug#17475: 24.3.91; bug of byte-optimize-zerop Shigeru Fukaya
2014-05-16 21:11 ` Shigeru Fukaya
2014-05-20 18:32   ` Stefan Monnier
2014-05-28  0:51   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).