xref: /titanic_41/usr/src/lib/efcode/fcode_test/bytemanipulate.fth (revision b3697b90e692e3e5d859fb77d285d4c056d99eda)
1\ #ident	"%Z%%M%	%I%	%E% SMI"
2\ purpose:
3\ copyright: Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
4\ copyright: Use is subject to license terms.
5\ copyright:
6\ copyright: CDDL HEADER START
7\ copyright:
8\ copyright: The contents of this file are subject to the terms of the
9\ copyright: Common Development and Distribution License, Version 1.0 only
10\ copyright: (the "License").  You may not use this file except in compliance
11\ copyright: with the License.
12\ copyright:
13\ copyright: You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14\ copyright: or http://www.opensolaris.org/os/licensing.
15\ copyright: See the License for the specific language governing permissions
16\ copyright: and limitations under the License.
17\ copyright:
18\ copyright: When distributing Covered Code, include this CDDL HEADER in each
19\ copyright: file and include the License file at usr/src/OPENSOLARIS.LICENSE.
20\ copyright: If applicable, add the following below this CDDL HEADER, with the
21\ copyright: fields enclosed by brackets "[]" replaced with your own identifying
22\ copyright: information: Portions Copyright [yyyy] [name of copyright owner]
23\ copyright:
24\ copyright: CDDL HEADER END
25\ copyright:
26
27." Byte Split tests: "
28	" lbsplit"	h# 11223344 lbsplit
29			h# 11 = swap  h# 22 = and swap
30			h# 33 = and swap h# 44 = and .passed?
31	" lwsplit"	h# 11223344 lwsplit
32			h# 1122 = swap h# 3344 = and .passed?
33	" wbsplit"	h# 31122 wbsplit
34			h# 11 = swap h# 22 = and .passed?
35	" wljoin"	h# beef h# dead wljoin h# deadbeef = .passed?
36	" bljoin"	h# 111 h# 222 h# 333 h# 444 bljoin
37			h# 44332211 = .passed?
38	" bwjoin"	h# 111 h# 222 bwjoin  h# 2211 = .passed?
39	" lbflip"	h# 11223344 lbflip h# 44332211 = .passed?
40	" lwflip"	h# 11223344 lwflip h# 33441122 = .passed?
41	" wbflip"	h# 31122 wbflip h# 2211 = .passed?
42create flip-area
43	h# 01020304 l,
44	" wbflips"	flip-area /l wbflips flip-area l@ h# 02010403 = .passed?
45	" lwflips"	flip-area /l lwflips flip-area l@ h# 04030201 = .passed?
46	" lbflips"	flip-area /l lbflips flip-area l@ h# 01020304 = .passed?
47cr
48
49." Memory ops: "
50	" comp +"	" abcde" drop " abcd" drop 5 comp 1 = .passed?
51	" comp -"	" abcd" drop " abcde" comp -1 = .passed?
52	" comp ="	" abcdef" drop " abcdef" comp 0= .passed?
53	" alloc-mem"	h# 100 dup alloc-mem ?dup
54			if 2swap -1 else drop false then .passed?
55	" free-mem"	2swap swap free-mem 1 .passed?
56cr
57