Blame types.h

Packit Service e18529
#ifndef TYPES_H
Packit Service e18529
#define TYPES_H
Packit Service e18529
Packit Service e18529
#include "config.h"
Packit Service e18529
Packit Service e18529
typedef unsigned char u8;
Packit Service e18529
typedef unsigned short u16;
Packit Service e18529
typedef signed short i16;
Packit Service e18529
typedef unsigned int u32;
Packit Service e18529
Packit Service e18529
/*
Packit Service e18529
 * You may use the following defines to adjust the type definitions
Packit Service e18529
 * depending on the architecture:
Packit Service e18529
 * - Define BIGENDIAN on big-endian systems.
Packit Service e18529
 * - Define ALIGNMENT_WORKAROUND if your system doesn't support
Packit Service e18529
 *   non-aligned memory access. In this case, we use a slower, but safer,
Packit Service e18529
 *   memory access method. This should be done automatically in config.h
Packit Service e18529
 *   for architectures which need it.
Packit Service e18529
 */
Packit Service e18529
Packit Service e18529
#ifdef BIGENDIAN
Packit Service e18529
typedef struct {
Packit Service e18529
	u32 h;
Packit Service e18529
	u32 l;
Packit Service e18529
} u64;
Packit Service e18529
#else
Packit Service e18529
typedef struct {
Packit Service e18529
	u32 l;
Packit Service e18529
	u32 h;
Packit Service e18529
} u64;
Packit Service e18529
#endif
Packit Service e18529
Packit Service e18529
#if defined(ALIGNMENT_WORKAROUND) || defined(BIGENDIAN)
Packit Service e18529
static inline u64 U64(u32 low, u32 high)
Packit Service e18529
{
Packit Service e18529
	u64 self;
Packit Service e18529
Packit Service e18529
	self.l = low;
Packit Service e18529
	self.h = high;
Packit Service e18529
Packit Service e18529
	return self;
Packit Service e18529
}
Packit Service e18529
#endif
Packit Service e18529
Packit Service e18529
/*
Packit Service e18529
 * Per SMBIOS v2.8.0 and later, all structures assume a little-endian
Packit Service e18529
 * ordering convention.
Packit Service e18529
 */
Packit Service e18529
#if defined(ALIGNMENT_WORKAROUND) || defined(BIGENDIAN)
Packit Service e18529
#define WORD(x) (u16)((x)[0] + ((x)[1] << 8))
Packit Service e18529
#define DWORD(x) (u32)((x)[0] + ((x)[1] << 8) + ((x)[2] << 16) + ((x)[3] << 24))
Packit Service e18529
#define QWORD(x) (U64(DWORD(x), DWORD(x + 4)))
Packit Service e18529
#else /* ALIGNMENT_WORKAROUND || BIGENDIAN */
Packit Service e18529
#define WORD(x) (u16)(*(const u16 *)(x))
Packit Service e18529
#define DWORD(x) (u32)(*(const u32 *)(x))
Packit Service e18529
#define QWORD(x) (*(const u64 *)(x))
Packit Service e18529
#endif /* ALIGNMENT_WORKAROUND || BIGENDIAN */
Packit Service e18529
Packit Service e18529
#endif