0bcec047e6f7f5d79bfa1e394ce1fc8d25fd0811
[openssl.git] / test / endian.h
1 /*
2  * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 #ifndef HEADER_INTERNAL_ENDIAN_H
11 # define HEADER_INTERNAL_ENDIAN_H
12
13 # define DECLARE_IS_ENDIAN \
14     const union { \
15         long one; \
16         char little; \
17     } ossl_is_endian = { 1 }
18
19 # define IS_LITTLE_ENDIAN (ossl_is_endian.little != 0)
20 # define IS_BIG_ENDIAN    (ossl_is_endian.little == 0)
21
22 #endif