]> mj.ucw.cz Git - libucw.git/blob - lib/config.h
Added macros for hinting branch predictor.
[libucw.git] / lib / config.h
1 /*
2  *      Sherlock -- Configuration-Dependent Definitions
3  *
4  *      (c) 1997--2003 Martin Mares <mj@ucw.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU Lesser General Public License.
8  */
9
10 #ifndef _SHERLOCK_CONFIG_H
11 #define _SHERLOCK_CONFIG_H
12
13 /* Configuration switches */
14
15 #include "lib/autoconf.h"
16
17 /* Version */
18
19 #define SHER_VER "2.5" SHERLOCK_VERSION_SUFFIX
20
21 /* Paths */
22
23 #define DEFAULT_CONFIG "cf/sherlock"
24
25 /* Types */
26
27 typedef unsigned char byte;             /* exactly 8 bits, unsigned */
28 typedef signed char sbyte;              /* exactly 8 bits, signed */
29 typedef unsigned short word;            /* exactly 16 bits, unsigned */
30 typedef short sword;                    /* exactly 16 bits, signed */
31 typedef unsigned short u16;             /* exactly 16 bits, unsigned */
32 typedef short s16;                      /* exactly 16 bits, signed */
33 typedef unsigned int u32;               /* exactly 32 bits, unsigned */
34 typedef int s32;                        /* exactly 32 bits, signed */
35 typedef unsigned int uns;               /* at least 32 bits */
36 typedef unsigned long long int u64;     /* exactly 64 bits, unsigned */
37 typedef long long int s64;              /* exactly 64 bits, signed */
38 typedef unsigned long addr_int_t;       /* Both integer and address */
39 typedef unsigned int sh_time_t;         /* Timestamp */
40
41 #ifndef NULL
42 #define NULL (void *)0
43 #endif
44
45 typedef u32 oid_t;                      /* Object ID */
46
47 /* Data types and functions for accessing file positions */
48
49 #ifdef CONFIG_LARGE_DB
50 typedef s64 sh_off_t;
51 #define BYTES_PER_O 5
52 #define BYTES_PER_P 8
53 #define bgeto(f) bget5(f)
54 #define bputo(f,l) bput5(f,l)
55 #define bgetp(f) bgetq(f)
56 #define bputp(f,l) bputq(f,l)
57 #define GET_O(p) GET_U40(p)
58 #define GET_P(p) GET_U64(p)
59 #define PUT_O(p,x) PUT_U40(p,x)
60 #define PUT_P(p,x) PUT_U64(p,x)
61 #else
62 typedef s32 sh_off_t;
63 #define BYTES_PER_O 4
64 #define BYTES_PER_P 4
65 #define bgeto(f) bgetl(f)
66 #define bputo(f,l) bputl(f,l)
67 #define bgetp(f) bgetl(f)
68 #define bputp(f,l) bputl(f,l)
69 #define GET_O(p) GET_U32(p)
70 #define GET_P(p) GET_U32(p)
71 #define PUT_O(p,x) PUT_U32(p,x)
72 #define PUT_P(p,x) PUT_U32(p,x)
73 #endif
74
75 /* Misc */
76
77 #ifdef __GNUC__
78
79 #undef inline
80 #define NONRET __attribute__((noreturn))
81 #define UNUSED __attribute__((unused))
82 #define CONSTRUCTOR __attribute__((constructor))
83 #define PACKED __attribute__((packed))
84 #define CONST __attribute__((const))
85 #define PURE __attribute__((const))
86 #define likely(x) __builtin_expect((x),1)
87 #define unlikely(x) __builtin_expect((x),0)
88
89 #else
90 #error This program requires the GNU C compiler.
91 #endif
92
93 #endif