[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: truth of %nil
From: |
Neil Jerram |
Subject: |
Re: truth of %nil |
Date: |
Mon, 06 Jul 2009 22:46:11 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
Mark H Weaver <address@hidden> writes:
> Below is a proposal for how to make boolean tests and end-of-list
> tests faster and more compact, by renumbering the representations for
> SCM_ELISP_NIL, SCM_EOL, SCM_UNDEFINED, and SCM_EOF_VAL.
Interesting. I haven't looked at every detail but I'm happy to go
along with Andy's impression.
Assuming you are planning to work on the code changes for this, we
will need copyright assignment papers from you. Will that be OK?
> along with a regression test somewhere to complain unless both of the
> XOR subexpressions above are powers of two:
>
> #define IS_POWER_OF_TWO(x) ((x) & ((x)-1) == 0)
> #define DIFFER_BY_ONLY_ONE_BIT(x, y) IS_POWER_OF_TWO((x)^(y))
>
> if ( ! DIFFER_BY_ONLY_ONE_BIT(SCM_ELISP_NIL, SCM_BOOL_F) )
> complain();
> if ( ! DIFFER_BY_ONLY_ONE_BIT(SCM_ELISP_NIL, SCM_EOL) )
> complain();
There are ways of writing compile time asserts; see
http://www.jaggersoft.com/pubs/CVu11_3.html for some. I don't know
how portable these all are, but at work we use the case label one, and
that seems to be good on common platforms.
Regards,
Neil
- Re: truth of %nil, (continued)
- Re: truth of %nil, Neil Jerram, 2009/07/01
- Re: truth of %nil, Mark H Weaver, 2009/07/02
- Re: truth of %nil, Ludovic Courtès, 2009/07/02
- Re: truth of %nil, Neil Jerram, 2009/07/02
- Re: truth of %nil, Mark H Weaver, 2009/07/03
- Re: truth of %nil, Mark H Weaver, 2009/07/04
- Re: truth of %nil, Andy Wingo, 2009/07/05
- Re: truth of %nil, Mark H Weaver, 2009/07/07
- Re: truth of %nil, Mark H. Weaver, 2009/07/08
- Re: truth of %nil,
Neil Jerram <=
- Re: truth of %nil, Mark H Weaver, 2009/07/06
- Re: truth of %nil, Ludovic Courtès, 2009/07/08
- Re: truth of %nil, Andy Wingo, 2009/07/23