arudradey/ml-cpu-storage / emsdk /upstream /emscripten /test /embind /test_embind_val_basics.cpp
arudradey's picture
download
raw
607 Bytes
#include <stdio.h>
#include <emscripten/val.h>
using namespace emscripten;
int main() {
val Math = val::global("Math");
// two ways to call Math.abs
printf("abs(-10): %d\n", Math.call<int>("abs", -10));
printf("abs(-11): %d\n", Math["abs"](-11).as<int>());
// Const-qualification and references should not matter.
int x = -12;
const int y = -13;
printf("abs(%d): %d\n", x, Math.call<int>("abs", x)); // x is deduced to int&
printf("abs(%d): %d\n", y, Math.call<int>("abs", y)); // y is deduced to const int&
printf("abs(-14): %d\n", Math.call<const int>("abs", -14));
return 0;
}

Xet Storage Details

Size:
607 Bytes
·
Xet hash:
c65a18ee0ea7b46b0af72aeb02abd8463b92b942bfe905e23b85a0241bf52596

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.