Thomas Heijligen | 9a2787b | 2021-10-12 15:54:06 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Carl-Daniel Hailfinger |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | /* |
| 17 | * This file determines the target endian. It should only be used by the Makefile |
| 18 | */ |
| 19 | |
| 20 | /* |
| 21 | * This works since gcc 4.6 and with clang |
| 22 | * https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html |
| 23 | */ |
| 24 | #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
| 25 | "big" |
| 26 | #elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
| 27 | "little" |
| 28 | #else |
| 29 | "unknown" |
| 30 | #endif |