dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / audio / include / archdep.h
blobc831445cbb1e128911085ac11bc77f14d7658608
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 (c) 1992-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _MULTIMEDIA_ARCHDEP_H
28 #define _MULTIMEDIA_ARCHDEP_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
37 * Machine-dependent and implementation-dependent definitions
38 * are placed here so that source code can be portable among a wide
39 * variety of machines.
43 * The following macros are used to generate architecture-specific
44 * code for handling byte-ordering correctly.
46 * Note that these macros *do not* work for in-place transformations.
49 #if defined(mc68000) || defined(sparc)
50 #define DECODE_SHORT(from, to) *((short *)(to)) = *((short *)(from))
51 #define DECODE_LONG(from, to) *((long *)(to)) = *((long *)(from))
52 #define DECODE_FLOAT(from, to) *((float *)(to)) = *((float *)(from))
53 #define DECODE_DOUBLE(from, to) *((double *)(to)) = *((double *)(from))
54 #endif /* big-endian */
56 #if defined(i386) || defined(__ppc)
57 #define DECODE_SHORT(from, to) \
58 ((char *)(to))[0] = ((char *)(from))[1]; \
59 ((char *)(to))[1] = ((char *)(from))[0];
60 #define DECODE_LONG(from, to) \
61 ((char *)(to))[0] = ((char *)(from))[3]; \
62 ((char *)(to))[1] = ((char *)(from))[2]; \
63 ((char *)(to))[2] = ((char *)(from))[1]; \
64 ((char *)(to))[3] = ((char *)(from))[0];
66 #define DECODE_FLOAT(from, to) DECODE_LONG((to), (from))
68 #define DECODE_DOUBLE(from, to) \
69 ((char *)(to))[0] = ((char *)(from))[7]; \
70 ((char *)(to))[1] = ((char *)(from))[6]; \
71 ((char *)(to))[2] = ((char *)(from))[5]; \
72 ((char *)(to))[3] = ((char *)(from))[4]; \
73 ((char *)(to))[4] = ((char *)(from))[3]; \
74 ((char *)(to))[5] = ((char *)(from))[2]; \
75 ((char *)(to))[6] = ((char *)(from))[1]; \
76 ((char *)(to))[7] = ((char *)(from))[0];
77 #endif /* little-endian */
80 /* Most architectures are symmetrical with respect to conversions. */
81 #if defined(mc68000) || defined(sparc) || defined(i386) || defined(__ppc)
82 #define ENCODE_SHORT(from, to) DECODE_SHORT((from), (to))
83 #define ENCODE_LONG(from, to) DECODE_LONG((from), (to))
84 #define ENCODE_FLOAT(from, to) DECODE_FLOAT((from), (to))
85 #define ENCODE_DOUBLE(from, to) DECODE_DOUBLE((from), (to))
87 /* Define types of specific length */
88 typedef char i_8;
89 typedef short i_16;
90 typedef int i_32;
91 typedef unsigned char u_8;
92 typedef unsigned short u_16;
93 typedef unsigned u_32;
95 #endif /* Sun machines */
97 #ifdef __cplusplus
99 #endif
101 #endif /* !_MULTIMEDIA_ARCHDEP_H */