Subject: Re: Last rights.
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1999/08/16
Newsgroups: comp.lang.lisp,comp.lang.forth
Message-ID: <7p82a1$qd3k@fido.engr.sgi.com>
Bernd Paysan  <bernd.paysan@gmx.de> wrote:
+---------------
| Stig E. Sand� wrote:
| > Does Forth have void or a false value 0 surrounded by millions
| > and millions of true values (all of them boiling down to the 1 true
| > faith)?
| 
| Yes, certainly. But the one true faith is -1 instead of 1 in C++. It
| also shows that by negating truth, you get just another truth.
+---------------

IIRC, the BLISS language also used -1 for the one true truth.

But let's not forget the AMD Am29000 series, wherein "truth" == "negative"
(or more precisely, a "1" in the most-significant bit), and the architecture
specifically *didn't* define any "one true truth" other than the MSB.

[In fact, unless you read some specific processor manual *very* closely, you
couldn't even find out *what* the "compare" instructions returned for that
processor model. On the 29000 and 29030, they happened to return #x80000000
for true and 0 for false, but AMD reserved the right to change that...]

Though since a boolean could be converted to a full-word mask in just one
more cycle, you could still get pipeline-efficient branch-free selection
of alterative values. E.g., the code "(if (< a b) c d)" could be coded as
the 5-cycle sequence [assuming "a"-"d" already in the registers]:

	cplt	t0, a, b
	sra	t0, t0, 31	; propagate sign bit throughout word
	and	t1, c, t0
	andn	t2, d, t0
	or	t0, t1, t2	; final result in t0


-Rob

-----
Rob Warnock, 8L-846		rpw3@sgi.com
Applied Networking		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		FAX: 650-933-0511
Mountain View, CA  94043	PP-ASEL-IA