Browse Source

Doc changed

wasm
Jordi Baylina 6 years ago
parent
commit
f445a95c8f
No known key found for this signature in database GPG Key ID: 7480C80C1BE43112
1 changed files with 53 additions and 0 deletions
  1. +53
    -0
      doc/wasmmodule.c

+ 53
- 0
doc/wasmmodule.c

@ -0,0 +1,53 @@
/*
(module
(export "get_signal_ptr" (func $get_signal_ptr))
(export "solve" (func $solve))
(func $get_signal_ptr (result i32)
(i32.const 22)
)
(func $solve (result i32)
(i32.const 22)
)
)
*/
typedef int u32;
typedef u32 u256[8];
struct Signals {
u256 one;
u256 output1;
u256 output2;
u256 pubInput1;
u256 pubInput2;
u256 prvInput1;
u256 prvInput2;
u256 internal1;
u256 internal2;
};
static Signals signals;
#ifdef __cplusplus
extern "C" {
#endif
u256 *get_signal_ptr() {
return (u256 *)&signals;
}
int solve() {
for (int i=0; i<8; i++) {
signals.internal1[i] = signals.pubInput1[i];
signals.internal2[i] = signals.pubInput2[i];
signals.output1[i] = signals.prvInput1[i];
signals.output2[i] = signals.prvInput2[i];
}
}
#ifdef __cplusplus
} // extern "C"
#endif

Loading…
Cancel
Save