summaryrefslogtreecommitdiff
path: root/audio_codec/libraac/include/helix_utils.h (plain)
blob: 40450ca2a5a69e6a752a73fbc44fd4d6a8e4dc6b
1/* ***** BEGIN LICENSE BLOCK *****
2 * Source last modified: $Id: helix_utils.h,v 1.1.1.1.2.1 2005/05/04 18:20:57 hubbe Exp $
3 *
4 * REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM
5 * Portions Copyright (c) 1995-2005 RealNetworks, Inc.
6 * All Rights Reserved.
7 *
8 * The contents of this file, and the files included with this file,
9 * are subject to the current version of the Real Format Source Code
10 * Porting and Optimization License, available at
11 * https://helixcommunity.org/2005/license/realformatsource (unless
12 * RealNetworks otherwise expressly agrees in writing that you are
13 * subject to a different license). You may also obtain the license
14 * terms directly from RealNetworks. You may not use this file except
15 * in compliance with the Real Format Source Code Porting and
16 * Optimization License. There are no redistribution rights for the
17 * source code of this file. Please see the Real Format Source Code
18 * Porting and Optimization License for the rights, obligations and
19 * limitations governing use of the contents of the file.
20 *
21 * RealNetworks is the developer of the Original Code and owns the
22 * copyrights in the portions it created.
23 *
24 * This file, and the files included with this file, is distributed and
25 * made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND,
26 * EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL
27 * SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT
29 * OR NON-INFRINGEMENT.
30 *
31 * Technology Compatibility Kit Test Suite(s) Location:
32 * https://rarvcode-tck.helixcommunity.org
33 *
34 * Contributor(s):
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38#ifndef HELIX_UTILS_H
39#define HELIX_UTILS_H
40
41#include "helix_config.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif /* #ifdef __cplusplus */
46
47
48 /*
49 * General support macros
50 *
51 */
52
53#define HX_MAX(a, b) (((a) > (b)) ? (a) : (b))
54#define HX_MIN(a, b) (((a) < (b)) ? (a) : (b))
55
56 /*
57 * Macro: IS_BIG_ENDIAN()
58 *
59 * Endianness detection macro.
60 * Requires local test_int = 0xFF for correct operation.
61 * Set ARCH_IS_BIG_ENDIAN in helix_config.h for best performance.
62 *
63 */
64
65#if !defined(ARCH_IS_BIG_ENDIAN)
66#define IS_BIG_ENDIAN(test_int) ((*((char*)&test_int)) == 0)
67#else
68#define IS_BIG_ENDIAN(test_int) ARCH_IS_BIG_ENDIAN
69#endif
70
71 /*
72 * Macro: HX_GET_MAJOR_VERSION()
73 *
74 * Given the encoded product version,
75 * returns the major version number.
76 */
77#define HX_GET_MAJOR_VERSION(prodVer) ((prodVer >> 28) & 0xF)
78
79 /*
80 * Macro: HX_GET_MINOR_VERSION()
81 *
82 * Given the encoded product version,
83 * returns the minor version number.
84 */
85#define HX_GET_MINOR_VERSION(prodVer) ((prodVer >> 20) & 0xFF)
86
87 /*
88 * Macro: HX_ENCODE_PROD_VERSION()
89 *
90 * Given the major version, minor version,
91 * release number, and build number,
92 * returns the encoded product version.
93 */
94#define HX_ENCODE_PROD_VERSION(major,minor,release,build) \
95 ((ULONG32)((ULONG32)major << 28) | ((ULONG32)minor << 20) | \
96 ((ULONG32)release << 12) | (ULONG32)build)
97
98#define HX_GET_PRIVATE_FIELD(ulversion)(ulversion & (UINT32)0xFF)
99
100#ifdef __cplusplus
101}
102#endif /* #ifdef __cplusplus */
103
104
105#endif /* HELIX_UTILS_H */
106
107