CAMLprim value set_digit_nat_native(value nat, value ofs, value digit)
{
  Digit_val(nat, Long_val(ofs)) = Nativeint_val(digit);
  return Val_unit;
}
示例#2
0
CAMLprim value
int56_of_nativeint(value v)
{
  CAMLparam1(v);
  CAMLreturn (copy_int64(((int64_t)Nativeint_val(v)) << 8));
}
示例#3
0
CAMLprim value caml_ba_fill(value vb, value vinit)
{
  struct caml_ba_array * b = Caml_ba_array_val(vb);
  intnat num_elts = caml_ba_num_elts(b);

  switch (b->flags & CAML_BA_KIND_MASK) {
  default:
    Assert(0);
  case CAML_BA_FLOAT32: {
    float init = Double_val(vinit);
    float * p;
    for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
    break;
  }
  case CAML_BA_FLOAT64: {
    double init = Double_val(vinit);
    double * p;
    for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
    break;
  }
  case CAML_BA_SINT8:
  case CAML_BA_UINT8: {
    int init = Int_val(vinit);
    char * p;
    for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
    break;
  }
  case CAML_BA_SINT16:
  case CAML_BA_UINT16: {
    int init = Int_val(vinit);
    int16 * p;
    for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
    break;
  }
  case CAML_BA_INT32: {
    int32 init = Int32_val(vinit);
    int32 * p;
    for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
    break;
  }
  case CAML_BA_INT64: {
    int64 init = Int64_val(vinit);
    int64 * p;
    for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
    break;
  }
  case CAML_BA_NATIVE_INT: {
    intnat init = Nativeint_val(vinit);
    intnat * p;
    for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
    break;
  }
  case CAML_BA_CAML_INT: {
    intnat init = Long_val(vinit);
    intnat * p;
    for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
    break;
  }
  case CAML_BA_COMPLEX32: {
    float init0 = Double_field(vinit, 0);
    float init1 = Double_field(vinit, 1);
    float * p;
    for (p = b->data; num_elts > 0; num_elts--) { *p++ = init0; *p++ = init1; }
    break;
  }
  case CAML_BA_COMPLEX64: {
    double init0 = Double_field(vinit, 0);
    double init1 = Double_field(vinit, 1);
    double * p;
    for (p = b->data; num_elts > 0; num_elts--) { *p++ = init0; *p++ = init1; }
    break;
  }
  }
  return Val_unit;
}
示例#4
0
CAMLprim value
uint128_of_nativeint(value v)
{
  CAMLparam1(v);
  CAMLreturn (copy_uint128((__uint128_t)Nativeint_val(v)));
}
示例#5
0
/* Llvm.lltype -> nativeint -> t */
CAMLprim value llvm_genericvalue_of_nativeint(LLVMTypeRef Ty, value NatInt) {
  CAMLparam1(NatInt);
  CAMLreturn(alloc_generic_value(
    LLVMCreateGenericValueOfInt(Ty, Nativeint_val(NatInt), 1)));
}
示例#6
0
CAMLprim value ml_set_long_at_pointer (value ptr, value n)
{
    *(long*)Pointer_val(ptr) = Nativeint_val(n);
    return Val_unit;
}
示例#7
0
CAMLprim value
int8_of_nativeint(value v)
{
  CAMLparam1(v);
  CAMLreturn (copy_int8((int8_t)Nativeint_val(v)));
}
示例#8
0
CAMLprim value
uint64_of_nativeint(value v)
{
  CAMLparam1(v);
  CAMLreturn (copy_uint64((uint64_t)Nativeint_val(v)));
}
示例#9
0
CAMLprim value caml_natjit_memcpy(value dst, value src, value size)
{
  D("caml_natjit_memcpy(%p, %p, %ld)\n", (void *)Nativeint_val(dst), String_val(src), Long_val(size));
  memcpy((void *)Nativeint_val(dst), String_val(src), Long_val(size));
  return Val_unit;
}