Never been using C, I guess-coded my way to this little program:
int pow(a)
{
for (int i=0;i<10;i++) a=a*2+1;
return a;
}
int main()
{
return pow(1);
}
And as far as I understand the output, the compiler on the server reduced it to a constant: (module
(table 0 anyfunc)
(memory $0 1)
(export "memory" (memory $0))
(export "pow" (func $pow))
(export "main" (func $main))
(func $pow (param $0 i32) (result i32)
(i32.or
(i32.shl
(get_local $0)
(i32.const 10)
)
(i32.const 1023)
)
)
(func $main (result i32)
(i32.const 2047)
)
)
Looking at the wasm code, I really hate it that I cannot edit it by hand and have the browser execute it. That would be fun.