1*0Sstevel@tonic-gate\ #ident "%Z%%M% %I% %E% SMI" 2*0Sstevel@tonic-gate\ purpose: 3*0Sstevel@tonic-gate\ copyright: Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4*0Sstevel@tonic-gate\ copyright: Use is subject to license terms. 5*0Sstevel@tonic-gate\ copyright: 6*0Sstevel@tonic-gate\ copyright: CDDL HEADER START 7*0Sstevel@tonic-gate\ copyright: 8*0Sstevel@tonic-gate\ copyright: The contents of this file are subject to the terms of the 9*0Sstevel@tonic-gate\ copyright: Common Development and Distribution License, Version 1.0 only 10*0Sstevel@tonic-gate\ copyright: (the "License"). You may not use this file except in compliance 11*0Sstevel@tonic-gate\ copyright: with the License. 12*0Sstevel@tonic-gate\ copyright: 13*0Sstevel@tonic-gate\ copyright: You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 14*0Sstevel@tonic-gate\ copyright: or http://www.opensolaris.org/os/licensing. 15*0Sstevel@tonic-gate\ copyright: See the License for the specific language governing permissions 16*0Sstevel@tonic-gate\ copyright: and limitations under the License. 17*0Sstevel@tonic-gate\ copyright: 18*0Sstevel@tonic-gate\ copyright: When distributing Covered Code, include this CDDL HEADER in each 19*0Sstevel@tonic-gate\ copyright: file and include the License file at usr/src/OPENSOLARIS.LICENSE. 20*0Sstevel@tonic-gate\ copyright: If applicable, add the following below this CDDL HEADER, with the 21*0Sstevel@tonic-gate\ copyright: fields enclosed by brackets "[]" replaced with your own identifying 22*0Sstevel@tonic-gate\ copyright: information: Portions Copyright [yyyy] [name of copyright owner] 23*0Sstevel@tonic-gate\ copyright: 24*0Sstevel@tonic-gate\ copyright: CDDL HEADER END 25*0Sstevel@tonic-gate\ copyright: 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate." Simple 0 Logic Tests: " 28*0Sstevel@tonic-gate " 0 invert" 0 invert .passed? 29*0Sstevel@tonic-gate " 0 0=" 0 0= .passed? 30*0Sstevel@tonic-gate " -1 invert" -1 invert 0= .passed? 31*0Sstevel@tonic-gate " 1 0<>" 1 0<> .passed? 32*0Sstevel@tonic-gate " 1 0=" 1 0= invert .passed? 33*0Sstevel@tonic-gate " 1 0<>" 1 0<> .passed? 34*0Sstevel@tonic-gate " 0 0>=" 0 0>= .passed? 35*0Sstevel@tonic-gate " 1 0>=" 1 0>= .passed? 36*0Sstevel@tonic-gate " -1 0>=" -1 0>= invert .passed? 37*0Sstevel@tonic-gate " 1 0>" 1 0> .passed? 38*0Sstevel@tonic-gate " 0 0>" 0 0> invert .passed? 39*0Sstevel@tonic-gate " -1 0<" -1 0< .passed? 40*0Sstevel@tonic-gate " 0 0<" 0 0< invert .passed? 41*0Sstevel@tonic-gate " 0 0<=" 0 0<= .passed? 42*0Sstevel@tonic-gate " -1 0<=" -1 0<= .passed? 43*0Sstevel@tonic-gate " 1 0<=" 1 0<= invert .passed? 44*0Sstevel@tonic-gatecr 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate." Positive Arithmetic Comparision Tests: " 47*0Sstevel@tonic-gate " 1 0 >" 1 0 > .passed? 48*0Sstevel@tonic-gate " 1 1 >=" 1 1 >= .passed? 49*0Sstevel@tonic-gate " 1 1 >" 1 1 > invert .passed? 50*0Sstevel@tonic-gate " 0 1 <" 0 1 < .passed? 51*0Sstevel@tonic-gate " 0 0 <=" 0 0 <= .passed? 52*0Sstevel@tonic-gate " 1 0 <" 1 0 < invert .passed? 53*0Sstevel@tonic-gate " 0 0 =" 0 0 = .passed? 54*0Sstevel@tonic-gate " 0 1 =" 0 1 = invert .passed? 55*0Sstevel@tonic-gate " 0 1 <>" 0 1 <> .passed? 56*0Sstevel@tonic-gate " 1 1 <>" 1 1 <> invert .passed? 57*0Sstevel@tonic-gatecr 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate." Signed Comparison Tests: " 60*0Sstevel@tonic-gate " -1 1 >" -1 1 > invert .passed? 61*0Sstevel@tonic-gate " -1 -2 >" -1 -2 > .passed? 62*0Sstevel@tonic-gate " -1 0 <" -1 0 < .passed? 63*0Sstevel@tonic-gate " -2 -1 <" -2 -1 < .passed? 64*0Sstevel@tonic-gatecr 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate." Unsigned Comparison Tests: " 67*0Sstevel@tonic-gate " -1 0 u>" -1 0 u> .passed? 68*0Sstevel@tonic-gate " -1 0 u>=" 1 1 u>= .passed? 69*0Sstevel@tonic-gate " 1 -1 <" 2 1 >= .passed? 70*0Sstevel@tonic-gate " 0 1 >=" 0 1 >= invert .passed? 71*0Sstevel@tonic-gate " 0 -1 u<" 0 -1 u< .passed? 72*0Sstevel@tonic-gate " 0 -1 u<=" 0 -1 u<= .passed? 73*0Sstevel@tonic-gate " 2 -2 u<=" 2 -2 u<= .passed? 74*0Sstevel@tonic-gatecr 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate." Arithmetic Tests: " 77*0Sstevel@tonic-gate " 1 1 +" 1 1 + 2 = .passed? 78*0Sstevel@tonic-gate " 1 1 -" 1 1 - 0 = .passed? 79*0Sstevel@tonic-gate " 1 negate " 1 negate 1+ 0= .passed? 80*0Sstevel@tonic-gate " 0 1 -" 0 1 - -1 = .passed? 81*0Sstevel@tonic-gate " -1 abs" -1 abs 1 = .passed? 82*0Sstevel@tonic-gate " -1 2 min" -1 2 min 1+ 0= .passed? 83*0Sstevel@tonic-gate " 2 -1 min" 2 -1 min 1+ 0= .passed? 84*0Sstevel@tonic-gate " 3 2 max" 3 2 max 3 = .passed? 85*0Sstevel@tonic-gate " 2 3 max" 2 3 max 3 = .passed? 86*0Sstevel@tonic-gatecr 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate." Binary Logic: " 89*0Sstevel@tonic-gate " 3 1 and" 3 1 and 1 = .passed? 90*0Sstevel@tonic-gate " 2 1 and" 2 1 and 0= .passed? 91*0Sstevel@tonic-gate " 1 1 or" 1 1 or 1 = .passed? 92*0Sstevel@tonic-gate " 3 1 xor" 3 1 xor 2 = .passed? 93*0Sstevel@tonic-gatecr 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate." Shifting: " 96*0Sstevel@tonic-gate " (short) lshift" h# 11 8 lshift h# 1100 = .passed? 97*0Sstevel@tonic-gate " (short) rshift" h# 1122 8 rshift h# 11 = .passed? 98*0Sstevel@tonic-gate " (long) lshift" h# 1 d# 31 lshift 1- h# 7fffffff = .passed? 99*0Sstevel@tonic-gate " (long) rshift" h# 80 d# 24 lshift d# 31 rshift 1 = .passed? 100*0Sstevel@tonic-gate " >>a" -4 1 >>a -2 = .passed? 101*0Sstevel@tonic-gatecr 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gate." Sized Arithmetic Tests: " 104*0Sstevel@tonic-gate " u2/" 0 0 0 h# 80 bljoin u2/ h# 4000.0000 = .passed? 105*0Sstevel@tonic-gate " 2/" -4 2/ -2 = .passed? 106*0Sstevel@tonic-gate " 2*" h# 4000.0000 dup 1 lshift swap 2* = .passed? 107*0Sstevel@tonic-gate " /c" 1 /c = .passed? 108*0Sstevel@tonic-gate " /w" 2 /w = .passed? 109*0Sstevel@tonic-gate " /l" 4 /l = .passed? 110*0Sstevel@tonic-gate " /n" 4 /n = 8 /n = or .passed? 111*0Sstevel@tonic-gate " ca+" h# 4000 3 ca+ h# 4003 = .passed? 112*0Sstevel@tonic-gate " wa+" h# 4000 3 wa+ h# 4006 = .passed? 113*0Sstevel@tonic-gate " la+" h# 4000 3 la+ h# 400c = .passed? 114*0Sstevel@tonic-gate " na+" h# 4000 3 na+ h# 4000 3 /n * + = .passed? 115*0Sstevel@tonic-gate " char+" h# 4000 char+ h# 4001 = .passed? 116*0Sstevel@tonic-gate " wa1+" h# 4000 wa1+ h# 4002 = .passed? 117*0Sstevel@tonic-gate " la1+" h# 4000 la1+ h# 4004 = .passed? 118*0Sstevel@tonic-gate " cell+" h# 4000 cell+ h# 4000 /n + = .passed? 119*0Sstevel@tonic-gate " chars" 4 chars 4 = .passed? 120*0Sstevel@tonic-gate " /w*" 8 /w* h# 10 = .passed? 121*0Sstevel@tonic-gate " /l*" 4 /l* h# 10 = .passed? 122*0Sstevel@tonic-gate " cells" 4 cells 4 /n * = .passed? 123*0Sstevel@tonic-gatecr 124*0Sstevel@tonic-gate 125*0Sstevel@tonic-gate." Division related Tests: " 126*0Sstevel@tonic-gate " /mod (+ +)" 5 2 /mod 2 = swap 1 = and .passed? 127*0Sstevel@tonic-gate " /mod (- -)" -5 -2 /mod 2 = swap -1 = and .passed? 128*0Sstevel@tonic-gate " /mod (+ -)" 5 -2 /mod -3 = swap -1 = and .passed? 129*0Sstevel@tonic-gate " /mod (- +)" -5 2 /mod -3 = swap 1 = and .passed? 130*0Sstevel@tonic-gate " / (+ +)" 5 2 / 2 = .passed? 131*0Sstevel@tonic-gate " / (- -)" -5 -2 / 2 = .passed? 132*0Sstevel@tonic-gate " / (+ -)" 5 -2 / -3 = .passed? 133*0Sstevel@tonic-gate " / (- +)" -5 2 / -3 = .passed? 134*0Sstevel@tonic-gate " mod (+ +)" 5 2 mod 1 = .passed? 135*0Sstevel@tonic-gate " mod (- -)" -5 -2 mod -1 = .passed? 136*0Sstevel@tonic-gate " mod (+ -)" 5 -2 mod -1 = .passed? 137*0Sstevel@tonic-gate " mod (- +)" -5 2 mod 1 = .passed? 138*0Sstevel@tonic-gatecr 139*0Sstevel@tonic-gate 140*0Sstevel@tonic-gate." Signed Multiply/Divide Tests:" 141*0Sstevel@tonic-gate " * (+ +)" 2 3 * 6 = .passed? 142*0Sstevel@tonic-gate " * (- +)" -3 3 * -9 = .passed? 143*0Sstevel@tonic-gate " * (+ -)" 4 -2 * -8 = .passed? 144*0Sstevel@tonic-gate " * (- -)" -4 -3 * 12 = .passed? 145*0Sstevel@tonic-gatecr 146*0Sstevel@tonic-gate 147*0Sstevel@tonic-gate." Unsigned Multiply/Divide Tests: " 148*0Sstevel@tonic-gate " um*" 1 2 um* 0= swap 2 = and .passed? 149*0Sstevel@tonic-gate " um/mod" 5 0 2 um/mod 2 = swap 1 = and .passed? 150*0Sstevel@tonic-gate " u/mod" 5 2 u/mod 2 = swap 1 = and .passed? 151*0Sstevel@tonic-gatecr 152*0Sstevel@tonic-gate 153*0Sstevel@tonic-gate." Ranged Tests: " 154*0Sstevel@tonic-gate " within (!0)" 2 1 3 within .passed? 155*0Sstevel@tonic-gate " within (0 hi)" 3 1 3 within 0= .passed? 156*0Sstevel@tonic-gate " within (!0 lo)" 1 1 3 within .passed? 157*0Sstevel@tonic-gate " within (0 >)" 0 1 3 within 0= .passed? 158*0Sstevel@tonic-gate " within (0 <)" 4 1 3 within 0= .passed? 159*0Sstevel@tonic-gate " within (-ve)" 0 -5 5 within .passed? 160*0Sstevel@tonic-gate " within (- -)" -7 -10 -5 within .passed? 161*0Sstevel@tonic-gate " between (!0)" 2 1 3 between .passed? 162*0Sstevel@tonic-gate " between (!0 lo)" 1 1 3 between .passed? 163*0Sstevel@tonic-gate " between (!0 hi)" 3 1 3 between .passed? 164*0Sstevel@tonic-gate " between (0 >)" 4 1 3 between 0= .passed? 165*0Sstevel@tonic-gate " between (0 <)" 0 1 3 between 0= .passed? 166*0Sstevel@tonic-gate " between (-ve)" 0 -5 5 between .passed? 167*0Sstevel@tonic-gate " between (- -)" -7 -10 -5 between .passed? 168*0Sstevel@tonic-gate " bounds" -1 3 bounds -1 = swap 2 = and .passed? 169*0Sstevel@tonic-gatecr 170*0Sstevel@tonic-gate 171*0Sstevel@tonic-gate." Double Arithmetic: " 172*0Sstevel@tonic-gate " d+" 1 2 3 4 d+ 6 = swap 4 = and .passed? 173*0Sstevel@tonic-gate " d-" 3 4 2 1 d- 3 = swap 1 = and .passed? 174*0Sstevel@tonic-gatecr 175