update hosts for cored target
WIP: currently the hosts are not generic and don't support different targets
This commit is contained in:
45
targets/wasm-module/cored.c
Normal file
45
targets/wasm-module/cored.c
Normal file
@ -0,0 +1,45 @@
|
||||
#include "../lib.h"
|
||||
#include "../lib_cored.h"
|
||||
|
||||
static enc_t cored_res;
|
||||
static enc_t filter_out[FILTER_COUNT];
|
||||
|
||||
void init_outputs(plain_t x_c, plain_t y_c, plain_t z_c) {
|
||||
/* Replicated Filtersteps */
|
||||
XC = encode(x_c, THE_A, SIG_X);
|
||||
YC = encode(y_c, THE_A, SIG_Y);
|
||||
ZC = encode(z_c, THE_A, SIG_Z);
|
||||
}
|
||||
|
||||
enc_t INLINE apply(enc_t vc, sign_t bdyn) {
|
||||
if (bdyn > SIG_MAX) {
|
||||
fail_marker_detected();
|
||||
}
|
||||
return vc + bdyn;
|
||||
}
|
||||
|
||||
sign_t wasm_module(void) {
|
||||
if (equals(XC, YC, SIG_X, SIG_Y)) {
|
||||
if (equals(XC, ZC, SIG_X, SIG_Z)) {
|
||||
cored_res = apply(XC, (XC - YC) + (XC - ZC));
|
||||
return SIG_s_XYZ;
|
||||
} else {
|
||||
cored_res = apply(XC, (XC - YC));
|
||||
return SIG_s_XY;
|
||||
}
|
||||
} else if (equals(YC, ZC, SIG_Y, SIG_Z)) {
|
||||
cored_res = apply(YC, (YC - ZC));
|
||||
return SIG_s_YZ;
|
||||
} else if (equals(XC, ZC, SIG_X, SIG_Z)) {
|
||||
cored_res = apply(XC, (XC - ZC));
|
||||
return SIG_s_XZ;
|
||||
} else {
|
||||
fail_marker_detected();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
enc_t get_cored_res() { return cored_res; }
|
||||
// enc_t get_xc() { return XC; }
|
||||
// enc_t get_yc() { return YC; }
|
||||
// enc_t get_zc() { return ZC; }
|
||||
Reference in New Issue
Block a user