| 1 | /* SPDX-License-Identifier: MIT */ |
| 2 | /* |
| 3 | * Copyright 2023 Advanced Micro Devices, Inc. |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | * Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be included in |
| 13 | * all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 21 | * OTHER DEALINGS IN THE SOFTWARE. |
| 22 | * |
| 23 | * Authors: AMD |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #ifndef __CMNTYPES_H__ |
| 28 | #define __CMNTYPES_H__ |
| 29 | |
| 30 | #ifdef __GNUC__ |
| 31 | #if __GNUC__ == 4 && __GNUC_MINOR__ > 7 |
| 32 | typedef unsigned int uint; |
| 33 | #endif |
| 34 | #endif |
| 35 | |
| 36 | typedef signed char int8, *pint8; |
| 37 | typedef signed short int16, *pint16; |
| 38 | typedef signed int int32, *pint32; |
| 39 | typedef signed int64, *pint64; |
| 40 | |
| 41 | typedef unsigned char uint8, *puint8; |
| 42 | typedef unsigned short uint16, *puint16; |
| 43 | typedef unsigned int uint32, *puint32; |
| 44 | typedef unsigned uint64, *puint64; |
| 45 | |
| 46 | typedef unsigned long int ulong; |
| 47 | typedef unsigned char uchar; |
| 48 | typedef unsigned int uint; |
| 49 | |
| 50 | typedef void *pvoid; |
| 51 | typedef char *pchar; |
| 52 | typedef const void *const_pvoid; |
| 53 | typedef const char *const_pchar; |
| 54 | |
| 55 | typedef struct rgba_struct { |
| 56 | uint8 a; |
| 57 | uint8 r; |
| 58 | uint8 g; |
| 59 | uint8 b; |
| 60 | } rgba_t; |
| 61 | |
| 62 | typedef struct { |
| 63 | uint8 blue; |
| 64 | uint8 green; |
| 65 | uint8 red; |
| 66 | uint8 alpha; |
| 67 | } gen_color_t; |
| 68 | |
| 69 | typedef union { |
| 70 | uint32 val; |
| 71 | gen_color_t f; |
| 72 | } gen_color_u; |
| 73 | |
| 74 | // |
| 75 | // Types to make it easy to get or set the bits of a float/double. |
| 76 | // Avoids automatic casting from int to float and back. |
| 77 | // |
| 78 | #if 0 |
| 79 | typedef union { |
| 80 | uint32 i; |
| 81 | float f; |
| 82 | } uintfloat32; |
| 83 | |
| 84 | typedef union { |
| 85 | uint64 i; |
| 86 | double f; |
| 87 | } uintfloat64; |
| 88 | |
| 89 | #ifndef UNREFERENCED_PARAMETER |
| 90 | #define UNREFERENCED_PARAMETER(x) (x = x) |
| 91 | #endif |
| 92 | #endif |
| 93 | |
| 94 | #endif //__CMNTYPES_H__ |
| 95 | |