Created
February 23, 2017 01:53
-
-
Save anonymous/652ff876293730601cccd1091f1ed446 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define TARGET(op) \ | |
L##op: \ | |
opcode = op; \ | |
case op: | |
void use(int); | |
void foo(int *p) { | |
static void *targets[16] = { | |
&&L0, | |
&&L1, | |
&&L2, | |
&&L3, | |
&&L4, | |
&&L5, | |
&&L6, | |
&&L7, | |
&&L8, | |
&&L9, | |
&&L10, | |
&&L11, | |
&&L12, | |
&&L13, | |
&&L14, | |
&&L15 | |
}; | |
int opcode = 0; | |
switch(*p++) { | |
TARGET(0) { use (opcode); goto *targets[*p++]; } | |
TARGET(1) { use (opcode); goto *targets[*p++]; } | |
TARGET(2) { use (opcode); goto *targets[*p++]; } | |
TARGET(3) { use (opcode); goto *targets[*p++]; } | |
TARGET(4) { use (opcode); goto *targets[*p++]; } | |
TARGET(5) { use (opcode); goto *targets[*p++]; } | |
TARGET(6) { use (opcode); goto *targets[*p++]; } | |
TARGET(7) { use (opcode); goto *targets[*p++]; } | |
TARGET(8) { use (opcode); goto *targets[*p++]; } | |
TARGET(9) { use (opcode); goto *targets[*p++]; } | |
TARGET(10) { use (opcode); goto *targets[*p++]; } | |
TARGET(11) { use (opcode); goto *targets[*p++]; } | |
TARGET(12) { use (opcode); goto *targets[*p++]; } | |
TARGET(13) { use (opcode); goto *targets[*p++]; } | |
TARGET(14) { use (opcode); goto *targets[*p++]; } | |
TARGET(15) { use (opcode); goto *targets[*p++]; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment