Debian Codegraph @

src/packed.h

raw
1 /*
2 * Copyright (c) 2018 Yubico AB. All rights reserved.
3 * Use of this source code is governed by a BSD-style
4 * license that can be found in the LICENSE file.
5 * SPDX-License-Identifier: BSD-2-Clause
6 */
7
8 #ifndef _PACKED_H
9 #define _PACKED_H
10
11 #if defined(__GNUC__)
12 #define PACKED_TYPE(type, def) \
13 typedef def __attribute__ ((__packed__)) type;
14 #elif defined(_MSC_VER)
15 #define PACKED_TYPE(type, def) \
16 __pragma(pack(push, 1)) \
17 typedef def type; \
18 __pragma(pack(pop))
19 #else
20 #error "please provide a way to define packed types on your platform"
21 #endif
22
23 #endif /* !_PACKED_H */