You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
The command never terminates. I have tried all combinations of options. Can anyone guide me in this regard? Or any other way to transform C++ code to respective web assembly code (help me design a stand-alone application ).
Content of the file is as follows:
double fact(int i) {
long long n = 1;
for (;i > 0; i--) {
n *= i;
}
return (double)n;
}
I want to compile a CPP file to web assembly. I am using scripts in the following link
https://github.com/wasdk/wasmexplorer-service/tree/master/scripts
I am using the following command in my Linux OS
../scripts/compile2.sh ../test.cpp "-fno-verbose-asm -03 -std=c++98" 2>&1
The command never terminates. I have tried all combinations of options. Can anyone guide me in this regard? Or any other way to transform C++ code to respective web assembly code (help me design a stand-alone application ).
Content of the file is as follows:
double fact(int i) {
long long n = 1;
for (;i > 0; i--) {
n *= i;
}
return (double)n;
}
My expected output is as following (is from https://mbebenita.github.io/WasmExplorer/)
(module
(table 0 anyfunc)
(memory $0 1)
(export "memory" (memory $0))
(export "_Z4facti" (func $_Z4facti))
(func $_Z4facti (; 0 ;) (param $0 i32) (result f64)
(local $1 i64)
(local $2 i64)
(block $label$0
(br_if $label$0
(i32.lt_s
(get_local $0)
(i32.const 1)
)
)
(set_local $1
(i64.add
(i64.extend_s/i32
(get_local $0)
)
(i64.const 1)
)
)
(set_local $2
(i64.const 1)
)
(loop $label$1
(set_local $2
(i64.mul
(get_local $2)
(tee_local $1
(i64.add
(get_local $1)
(i64.const -1)
)
)
)
)
(br_if $label$1
(i64.gt_s
(get_local $1)
(i64.const 1)
)
)
)
(return
(f64.convert_s/i64
(get_local $2)
)
)
)
(f64.const 1)
)
)
The text was updated successfully, but these errors were encountered: