10afa8e06SEd Maste /* 20afa8e06SEd Maste * Copyright (c) 2018 Yubico AB. All rights reserved. 30afa8e06SEd Maste * Use of this source code is governed by a BSD-style 40afa8e06SEd Maste * license that can be found in the LICENSE file. 5*2ccfa855SEd Maste * SPDX-License-Identifier: BSD-2-Clause 60afa8e06SEd Maste */ 70afa8e06SEd Maste 80afa8e06SEd Maste #ifndef _PACKED_H 90afa8e06SEd Maste #define _PACKED_H 100afa8e06SEd Maste 110afa8e06SEd Maste #if defined(__GNUC__) 120afa8e06SEd Maste #define PACKED_TYPE(type, def) \ 130afa8e06SEd Maste typedef def __attribute__ ((__packed__)) type; 140afa8e06SEd Maste #elif defined(_MSC_VER) 150afa8e06SEd Maste #define PACKED_TYPE(type, def) \ 160afa8e06SEd Maste __pragma(pack(push, 1)) \ 170afa8e06SEd Maste typedef def type; \ 180afa8e06SEd Maste __pragma(pack(pop)) 190afa8e06SEd Maste #else 200afa8e06SEd Maste #error "please provide a way to define packed types on your platform" 210afa8e06SEd Maste #endif 220afa8e06SEd Maste 230afa8e06SEd Maste #endif /* !_PACKED_H */ 24