[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: kddlab!atr-la.atr.co.jp!myers@uunet.uu.net (John K. Myers)*Subject*: 3-way arithmetic IF*From*: barmar@Think.COM (Barry Margolin)*Date*: Thu, 1 Aug 1991 13:25:00 -0400*Cc*: slug@ai.sri.com*In-reply-to*: <9108010619.AA06850@atr-la.atr-la.atr.co.jp>

Date: Thu, 1 Aug 1991 02:19 EDT From: kddlab!atr-la.atr.co.jp!myers@uunet.UU.NET (John K. Myers) I need to compare two integers x and y, and perform routine 1 if x<y, routine 2 if x=y, and routine 3 if x>y. X and Y are bignums on the order of six words long. The operation must be as fast as possible. Testing x<y takes about 85-95 microseconds; testing x=y takes about 79-83 microseconds; total worst-case time of about 178 microseconds. Evaluating (signum (- x y)) takes about 175 microseconds. Question: Is there a low-level arithmetic IF somewhere down in the guts of the machine, that supports a single </=/> comparison between two numbers and then switches control three ways accordingly? If there were, I think they would have used it in the implementation of SIGNUM, but it mostly consists of a bunch of (COND ((PLUSP NUMBER) 1) ((MINUSP NUMBER) -1) (T NUMBER)) forms (different ones for different argument data types, since the value type is supposed to be the same as the argument type). The only three-way conditional instruction I can think of is BRANCH-NOT-ENDP. It branches if the argument is a cons, falls through if it's NIL, and generates a WRONG-TYPE-ARGUMENT-TRAP otherwise. barmar

**References**:**3-way arithmetic IF***From:*kddlab!atr-la.atr.co.jp!myers@uunet.UU.NET (John K. Myers)

- Prev by Date:
**assigning keystroke in mode table/zmacs question** - Next by Date:
**SYS:SITE; A novice adminstrator's question** - Previous by thread:
**3-way arithmetic IF** - Next by thread:
**Lisp Users Group Conference** - Index(es):