Skip to content

Commit 2bbb36b

Browse files
committed
convert optokens from defines to enum
1 parent 37ed6c8 commit 2bbb36b

File tree

1 file changed

+65
-63
lines changed

1 file changed

+65
-63
lines changed

optokens.h

Lines changed: 65 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,72 +4,74 @@
44
#ifndef BINOP_H
55
#define BINOP_H
66

7-
#define K_ASSIGN 0x100
8-
#define K_BOOL_OR 0x101
9-
#define K_BOOL_AND 0x102
10-
#define K_GE 0x103
11-
#define K_LE 0x104
12-
#define K_NE 0x105
13-
#define K_EQ 0x106
14-
#define K_LIMITMIN 0x107
15-
#define K_LIMITMAX 0x108
16-
#define K_MODULUS 0x109
17-
#define K_HIGHMULT 0x10A
18-
#define K_ROTR 0x10B
19-
#define K_ROTL 0x10C
20-
#define K_SHL 0x10D
21-
#define K_SHR 0x10E
22-
#define K_SAR 0x10F
23-
#define K_REV 0x110
24-
#define K_NEGATE 0x111
25-
#define K_BIT_NOT 0x112
26-
#define K_SQRT 0x113
27-
#define K_ABS 0x114
28-
#define K_DECODE 0x115
29-
#define K_ENCODE 0x116
30-
#define K_BOOL_NOT 0x117
31-
#define K_SGNCOMP 0x118
32-
#define K_INCREMENT 0x119
33-
#define K_DECREMENT 0x11a
34-
#define K_BOOL_XOR 0x11b
35-
#define K_UNS_DIV 0x11c
36-
#define K_UNS_MOD 0x11d
37-
#define K_SIGNEXTEND 0x11e
38-
#define K_ZEROEXTEND 0x11f
39-
#define K_LTU 0x120
40-
#define K_LEU 0x121
41-
#define K_GTU 0x122
42-
#define K_GEU 0x123
43-
#define K_ASC 0x124
44-
#define K_LIMITMIN_UNS 0x125
45-
#define K_LIMITMAX_UNS 0x126
46-
#define K_POWER 0x127
47-
#define K_FRAC64 0x128
48-
#define K_UNS_HIGHMULT 0x129
49-
#define K_ONES_COUNT 0x12a
50-
#define K_QLOG 0x12b
51-
#define K_QEXP 0x12c
52-
#define K_SCAS 0x12d
53-
#define K_ENCODE2 0x12e
7+
enum OpToken {
8+
K_ASSIGN = 0x100,
9+
K_BOOL_OR,
10+
K_BOOL_AND,
11+
K_GE,
12+
K_LE,
13+
K_NE,
14+
K_EQ,
15+
K_LIMITMIN,
16+
K_LIMITMAX,
17+
K_MODULUS,
18+
K_HIGHMULT,
19+
K_ROTR,
20+
K_ROTL,
21+
K_SHL,
22+
K_SHR,
23+
K_SAR,
24+
K_REV,
25+
K_NEGATE,
26+
K_BIT_NOT,
27+
K_SQRT,
28+
K_ABS,
29+
K_DECODE,
30+
K_ENCODE,
31+
K_BOOL_NOT,
32+
K_SGNCOMP,
33+
K_INCREMENT,
34+
K_DECREMENT,
35+
K_BOOL_XOR,
36+
K_UNS_DIV,
37+
K_UNS_MOD,
38+
K_SIGNEXTEND,
39+
K_ZEROEXTEND,
40+
K_LTU,
41+
K_LEU,
42+
K_GTU,
43+
K_GEU,
44+
K_ASC,
45+
K_LIMITMIN_UNS,
46+
K_LIMITMAX_UNS,
47+
K_POWER,
48+
K_FRAC64,
49+
K_UNS_HIGHMULT,
50+
K_ONES_COUNT,
51+
K_QLOG,
52+
K_QEXP,
53+
K_SCAS,
54+
K_ENCODE2,
5455
/* spin versions of && and ||, which cannot short-circuit */
55-
#define K_LOGIC_AND 0x12f
56-
#define K_LOGIC_OR 0x130
57-
#define K_LOGIC_XOR 0x131
56+
K_LOGIC_AND,
57+
K_LOGIC_OR,
58+
K_LOGIC_XOR,
5859

5960
/* floating point */
6061
/* these get turned into function calls */
61-
#define K_FEQ 0x132
62-
#define K_FNE 0x133
63-
#define K_FLT 0x134
64-
#define K_FGT 0x135
65-
#define K_FLE 0x136
66-
#define K_FGE 0x137
67-
#define K_FADD 0x138
68-
#define K_FSUB 0x139
69-
#define K_FMUL 0x13a
70-
#define K_FDIV 0x13b
71-
#define K_FNEGATE 0x13c
72-
#define K_FABS 0x13d
73-
#define K_FSQRT 0x13e
62+
K_FEQ,
63+
K_FNE,
64+
K_FLT,
65+
K_FGT,
66+
K_FLE,
67+
K_FGE,
68+
K_FADD,
69+
K_FSUB,
70+
K_FMUL,
71+
K_FDIV,
72+
K_FNEGATE,
73+
K_FABS,
74+
K_FSQRT,
75+
};
7476

7577
#endif

0 commit comments

Comments
 (0)