8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libcurses / screen / memSset.c
blob192d42b9180e68affabce889c76d79950064dd16
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
33 * All Rights Reserved
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
37 * contributors.
40 #pragma ident "%Z%%M% %I% %E% SMI"
42 /*LINTLIBRARY*/
44 #include <sys/types.h>
45 #include "curses.h"
48 * additional memory routine to deal with memory areas in units of chtypes.
51 void
52 memSset(chtype *s, chtype c, int n)
54 #if u3b
56 int count; /* %r8 */
57 char *from; /* %r7 */
58 char *to; /* %r6 */
60 count = (n - 1) * sizeof (chtype);
61 if (count > 0) {
62 chtype *sfrom = s; /* %r5 */
64 to = (char *)(sfrom + 1);
65 from = (char *)sfrom;
66 *sfrom = c;
67 asm(" movblkb %r8, %r7, %r6");
68 /* bcopy (count, to, from) */
69 } else if (count == 0)
70 *s = c;
72 #else
73 #if u3b2 || u3b15
75 char *to; /* 0(%fp) */
76 char *from; /* 4(%fp) */
77 int count; /* %r8 */
79 count = (n - 1) * sizeof (chtype);
80 if (count > 0) {
81 chtype *sfrom = s; /* %r7 */
83 to = (char *)(sfrom + 1);
84 from = (char *)sfrom;
85 *sfrom = c;
87 /* Evidently one can not specify the regs for movblb. So I move */
88 /* them in myself below to the regs where they belong. */
89 asm(" movw %r8,%r2"); /* count */
90 asm(" movw 0(%fp),%r1"); /* to */
91 asm(" movw 4(%fp),%r0"); /* from */
92 asm(" movblb");
93 } else if (count == 0)
94 *s = c;
96 #else
98 while (n-- > 0)
99 *s++ = c;
101 #endif /* u3b2 || u3b15 */
102 #endif /* u3b */
104 /* The vax block copy command doesn't work the way I want. */
105 /* If anyone finds a version that does, I'd like to know. */
106 #if __bad__vax__
108 /* this is the code within memcpy which shows how to do a block copy */
110 memcpy(char *to, char *from, int count)
112 if (count > 0) {
113 asm(" movc3 12(ap),*4(ap),*8(ap)");
116 #endif /* __bad__vax__ */