Created
June 27, 2018 07:40
-
-
Save gskachkov/499edb11e2a32320c9b279cc93340aa5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 WASM_EXPORT __attribute__((visibility("default"))) | |
extern long add_js(long int a, long int b); | |
long int add_wasm(long int a, long int b) | |
{ | |
return a + b; | |
} | |
WASM_EXPORT | |
long int fibonacci_wasm(long int num) | |
{ | |
long int a = 1, b = 0, temp; | |
while (num >= 0) { | |
temp = a; | |
a = add_wasm(a, b); | |
b = temp; | |
num--; | |
} | |
return b; | |
} | |
WASM_EXPORT | |
long int fibonacci_js(long int num) | |
{ | |
long int a = 1, b = 0, temp; | |
while (num >= 0) { | |
temp = a; | |
a = add_js(a, b); | |
b = temp; | |
num--; | |
} | |
return b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment