-
-
Save wycats/4845049dcf0f6571387a 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
Module["asm"] = (function(global, env, buffer) { | |
"use asm"; | |
var HEAP8 = new global.Int8Array(buffer); | |
var STACKTOP = env.STACKTOP | 0; | |
var _some_external_JS = env._some_external_JS; | |
function _main() { | |
var i1 = 0, i2 = 0; | |
i1 = STACKTOP; | |
STACKTOP = STACKTOP + 16 | 0; | |
i2 = i1; | |
HEAP8[i2 >> 0] = 1; | |
_some_external_JS(i2 | 0); | |
STACKTOP = i1; | |
return 0; | |
} | |
return { | |
_main: _main | |
}; | |
}); |
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
#include <stdint.h> | |
typedef struct { | |
uint8_t op; | |
uint32_t operand1; | |
uint32_t operand2; | |
} opcode_t; | |
extern void some_external_JS(opcode_t* opcode); | |
int main() { | |
opcode_t op; | |
op.op = 1; | |
some_external_JS(&op); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment