1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/*
* This file is generated from directiv.dat
* by directiv.pl; do not edit.
*/
#include "compiler.h"
#include <string.h>
#include "nasm.h"
#include "hashtbl.h"
#include "directiv.h"
const char * const directives[26] =
{
NULL,
NULL,
"absolute",
"bits",
"common",
"cpu",
"debug",
"default",
"extern",
"float",
"global",
"list",
"section",
"segment",
"warning",
"sectalign",
"export",
"group",
"import",
"library",
"map",
"module",
"org",
"osabi",
"safeseh",
"uppercase"
};
enum directives find_directive(const char *token)
{
#define UNUSED 16383
static const int16_t hash1[32] = {
0,
UNUSED,
UNUSED,
UNUSED,
UNUSED,
0,
0,
10,
0,
10,
UNUSED,
UNUSED,
UNUSED,
0,
0,
UNUSED,
UNUSED,
UNUSED,
UNUSED,
0,
UNUSED,
23,
17,
12,
-15,
14,
UNUSED,
UNUSED,
21,
-18,
14,
3,
};
static const int16_t hash2[32] = {
0,
UNUSED,
UNUSED,
UNUSED,
0,
UNUSED,
6,
0,
20,
2,
0,
29,
0,
0,
3,
UNUSED,
UNUSED,
UNUSED,
8,
22,
9,
1,
UNUSED,
UNUSED,
UNUSED,
UNUSED,
1,
5,
UNUSED,
UNUSED,
-4,
UNUSED,
};
uint32_t k1, k2;
uint64_t crc;
uint16_t ix;
crc = crc64i(UINT64_C(0x076259c3e291c26c), token);
k1 = (uint32_t)crc;
k2 = (uint32_t)(crc >> 32);
ix = hash1[k1 & 0x1f] + hash2[k2 & 0x1f];
if (ix >= 24)
return D_unknown;
ix += 2;
if (nasm_stricmp(token, directives[ix]))
return D_unknown;
return ix;
}
|