Skip to content

Commit eb9b171

Browse files
committed
2% performance gains by using sequential enum values
1 parent 25e9cfa commit eb9b171

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/brainfuck/parse.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@
1010
namespace brainfuck {
1111

1212
enum Type : uint8_t {
13-
NOOP = '_',
14-
DONE = '0',
13+
NOOP,
14+
DONE,
1515

16-
DATA_ADD = '+',
17-
DATA_SET = '=',
16+
DATA_ADD,
17+
DATA_SET,
1818

1919
// [->+<] :: (transfer)(add -1)(add 1 at offset 1)
20-
DATA_TRANSFER = '~',
20+
DATA_TRANSFER,
2121
// [->++<] :: (multiplyer)(add -1)(add 2 at offset 1)
22-
DATA_MULTIPLY = 'x',
22+
DATA_MULTIPLY,
2323
// [-->+++<] :: (multiplyer & divide)(add -2)(add 3 at offset 1)
24-
DATA_MULTIPLY_AND_DIVIDE = '*',
24+
DATA_MULTIPLY_AND_DIVIDE,
2525

26-
DATA_SET_FROM_INPUT = ',',
27-
DATA_PRINT = '.',
26+
DATA_SET_FROM_INPUT,
27+
DATA_PRINT,
2828

29-
DATA_POINTER_ADD = '>',
30-
DATA_POINTER_ADD_WHILE_NOT_ZERO = '^',
29+
DATA_POINTER_ADD,
30+
DATA_POINTER_ADD_WHILE_NOT_ZERO,
3131

32-
INSTRUCTION_POINTER_SET_IF_ZERO = '[',
33-
INSTRUCTION_POINTER_SET_IF_NOT_ZERO = ']',
32+
INSTRUCTION_POINTER_SET_IF_ZERO,
33+
INSTRUCTION_POINTER_SET_IF_NOT_ZERO,
3434
};
3535

3636
using Value = int32_t;

0 commit comments

Comments
 (0)