Force functions marked as inline to always be inlined.
[seabios.git] / src / types.h
1 // Basic type definitions for X86 cpus.
2 //
3 // Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
4 //
5 // This file may be distributed under the terms of the GNU GPLv3 license.
6 #ifndef __TYPES_H
7 #define __TYPES_H
8
9 typedef unsigned char u8;
10 typedef signed char s8;
11 typedef unsigned short u16;
12 typedef signed short s16;
13 typedef unsigned int u32;
14 typedef signed int s32;
15 typedef u32 size_t;
16
17 #define __VISIBLE __attribute__((externally_visible))
18 #ifdef MODE16
19 // Notes a function as externally visible in the 16bit code chunk.
20 #define VISIBLE16 __VISIBLE
21 // Notes a function as externally visible in the 32bit code chunk.
22 #define VISIBLE32
23 #else
24 #define VISIBLE16
25 #define VISIBLE32 __VISIBLE
26 #endif
27
28 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
29 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
30
31 #define NULL ((void *)0)
32
33 #define PACKED __attribute__((packed))
34
35 #define barrier() __asm__ __volatile__("": : :"memory")
36
37 #define inline inline __attribute__((always_inline))
38
39 #define __stringify_1(x)        #x
40 #define __stringify(x)          __stringify_1(x)
41
42 #endif // types.h