Skip to content

Instantly share code, notes, and snippets.

@zzarcon
Created January 9, 2017 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzarcon/8d15dd9da9c39a15c254fceb0a6578d2 to your computer and use it in GitHub Desktop.
Save zzarcon/8d15dd9da9c39a15c254fceb0a6578d2 to your computer and use it in GitHub Desktop.
(function($0) {var stack = Runtime.stackSave();var str = $0;var ret = 0;
if (str !== null && str !== undefined && str !== 0) { // null string
// at most 4 bytes per UTF-8 code point, +1 for the trailing '\0'
var len = (str.length << 2) + 1;
ret = Runtime.stackAlloc(len);
stringToUTF8(str, ret, len);
};$0=(ret);var ret = cfunc($0);if (typeof EmterpreterAsync === 'object') { assert(!EmterpreterAsync.state, 'cannot start async op with normal JS calling cwrap') }Runtime.stackRestore(stack);return ret})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment