2018-02-01 22:19:23 +01:00
|
|
|
#include <math.h>
|
|
|
|
#include <caml/mlvalues.h>
|
|
|
|
#include <caml/alloc.h>
|
|
|
|
|
|
|
|
|
|
|
|
CAMLprim value erf_float_bytecode(value x)
|
|
|
|
{
|
|
|
|
return copy_double(erf(Double_val(x)));
|
|
|
|
}
|
|
|
|
|
|
|
|
CAMLprim double erf_float(double x)
|
|
|
|
{
|
|
|
|
return erf(x);
|
|
|
|
}
|
|
|
|
|
2018-02-01 22:39:23 +01:00
|
|
|
|
|
|
|
CAMLprim value erfc_float_bytecode(value x)
|
|
|
|
{
|
|
|
|
return copy_double(erfc(Double_val(x)));
|
|
|
|
}
|
|
|
|
|
|
|
|
CAMLprim double erfc_float(double x)
|
|
|
|
{
|
|
|
|
return erfc(x);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CAMLprim value gamma_float_bytecode(value x)
|
|
|
|
{
|
|
|
|
return copy_double(tgamma(Double_val(x)));
|
|
|
|
}
|
|
|
|
|
2019-03-03 01:43:04 +01:00
|
|
|
|
2018-02-01 22:39:23 +01:00
|
|
|
CAMLprim double gamma_float(double x)
|
|
|
|
{
|
|
|
|
return tgamma(x);
|
|
|
|
}
|
|
|
|
|
2019-03-03 01:43:04 +01:00
|
|
|
|
2019-04-03 22:17:20 +02:00
|
|
|
#include <stdio.h>
|
2019-03-03 01:43:04 +01:00
|
|
|
CAMLprim int32_t popcnt(int64_t i)
|
|
|
|
{
|
|
|
|
return __builtin_popcountll (i);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CAMLprim value popcnt_bytecode(value i)
|
|
|
|
{
|
2019-12-03 12:25:31 +01:00
|
|
|
return caml_copy_int32(__builtin_popcountll (Int64_val(i)));
|
2019-03-03 01:43:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CAMLprim int32_t trailz(int64_t i)
|
|
|
|
{
|
|
|
|
return __builtin_ctzll (i);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CAMLprim value trailz_bytecode(value i)
|
|
|
|
{
|
2019-12-03 12:25:31 +01:00
|
|
|
return caml_copy_int32(__builtin_ctzll (Int64_val(i)));
|
2019-03-03 01:43:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
CAMLprim int32_t leadz(int64_t i)
|
|
|
|
{
|
|
|
|
return __builtin_clzll(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CAMLprim value leadz_bytecode(value i)
|
|
|
|
{
|
2019-12-03 12:25:31 +01:00
|
|
|
return caml_copy_int32(__builtin_clzll (Int64_val(i)));
|
2019-03-03 01:43:04 +01:00
|
|
|
}
|
|
|
|
|
2019-10-24 11:25:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
CAMLprim value unix_vfork(value unit)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
ret = vfork();
|
|
|
|
return Val_int(ret);
|
|
|
|
}
|
|
|
|
|