当前位置: 首页>>代码示例>>C++>>正文


C++ Int64_val函数代码示例

本文整理汇总了C++中Int64_val函数的典型用法代码示例。如果您正苦于以下问题:C++ Int64_val函数的具体用法?C++ Int64_val怎么用?C++ Int64_val使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Int64_val函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: netsys_fallocate

CAMLprim value netsys_fallocate(value fd, value start, value len) {
#ifdef HAVE_POSIX_FALLOCATE
    int r;
    int64 start_int, len_int;
    off_t start_off, len_off;
    /* Att: off_t might be 64 bit even on 32 bit systems! */

    start_int = Int64_val(start);
    len_int = Int64_val(len);

    if ( ((int64) ((off_t) start_int)) != start_int )
	failwith("Netsys.fadvise: large files not supported on this OS");
    if ( ((int64) ((off_t) len_int)) != len_int )
	failwith("Netsys.fadvise: large files not supported on this OS");

    start_off = start_int;
    len_off = len_int;

    r = posix_fallocate(Int_val(fd), start_off, len_off);
    /* does not set errno! */
    if (r != 0) 
	unix_error(r, "posix_fallocate64", Nothing);
    return Val_unit;
#else
    invalid_argument("Netsys.fallocate not available");
#endif
}
开发者ID:iSCGroup,项目名称:libres3,代码行数:27,代码来源:netsys_c_fallocate.c

示例2: domain_build_info_val

static int domain_build_info_val (caml_gc *gc, libxl_domain_build_info *c_val, value v)
{
	CAMLparam1(v);
	CAMLlocal1(infopriv);

	c_val->max_vcpus = Int_val(Field(v, 0));
	c_val->cur_vcpus = Int_val(Field(v, 1));
	c_val->max_memkb = Int64_val(Field(v, 2));
	c_val->target_memkb = Int64_val(Field(v, 3));
	c_val->video_memkb = Int64_val(Field(v, 4));
	c_val->shadow_memkb = Int64_val(Field(v, 5));
	c_val->kernel.path = dup_String_val(gc, Field(v, 6));
	c_val->is_hvm = Tag_val(Field(v, 7)) == 0;
	infopriv = Field(Field(v, 7), 0);
	if (c_val->hvm) {
		c_val->u.hvm.pae = Bool_val(Field(infopriv, 0));
		c_val->u.hvm.apic = Bool_val(Field(infopriv, 1));
		c_val->u.hvm.acpi = Bool_val(Field(infopriv, 2));
		c_val->u.hvm.nx = Bool_val(Field(infopriv, 3));
		c_val->u.hvm.viridian = Bool_val(Field(infopriv, 4));
		c_val->u.hvm.timeoffset = dup_String_val(gc, Field(infopriv, 5));
		c_val->u.hvm.timer_mode = Int_val(Field(infopriv, 6));
		c_val->u.hvm.hpet = Int_val(Field(infopriv, 7));
		c_val->u.hvm.vpt_align = Int_val(Field(infopriv, 8));
	} else {
		c_val->u.pv.slack_memkb = Int64_val(Field(infopriv, 0));
		c_val->u.pv.cmdline = dup_String_val(gc, Field(infopriv, 1));
		c_val->u.pv.ramdisk.path = dup_String_val(gc, Field(infopriv, 2));
		c_val->u.pv.features = dup_String_val(gc, Field(infopriv, 3));
	}

	CAMLreturn(0);
}
开发者ID:Angel666,项目名称:android_hardware_intel,代码行数:33,代码来源:xl_stubs.c

示例3: caml_int64_div

CAMLprim value caml_int64_div(value v1, value v2)
{
  int64 dividend = Int64_val(v1);
  int64 divisor = Int64_val(v2);
  if (I64_is_zero(divisor)) caml_raise_zero_divide();
  /* PR#4740: on some processors, division crashes on overflow.
     Implement the same behavior as for type "int". */
  if (I64_is_min_int(dividend) && I64_is_minus_one(divisor)) return v1;
  return caml_copy_int64(I64_div(Int64_val(v1), divisor));
}
开发者ID:dirkdokter,项目名称:pprz-installer-fedora,代码行数:10,代码来源:ints.c

示例4: domain_build_state_val

static int domain_build_state_val(caml_gc *gc, libxl_domain_build_state *c_val, value v)
{
	CAMLparam1(v);

	c_val->store_port = Int_val(Field(v, 0));
	c_val->store_mfn = Int64_val(Field(v, 1));
	c_val->console_port = Int_val(Field(v, 2));
	c_val->console_mfn = Int64_val(Field(v, 3));
	
	CAMLreturn(0);
}
开发者ID:Angel666,项目名称:android_hardware_intel,代码行数:11,代码来源:xl_stubs.c

示例5: guestfs_int_mllib_progress_bar_set

/* NB: "noalloc" function. */
value
guestfs_int_mllib_progress_bar_set (value barv,
                                    value positionv, value totalv)
{
  struct progress_bar *bar = Bar_val (barv);
  uint64_t position = Int64_val (positionv);
  uint64_t total = Int64_val (totalv);

  progress_bar_set (bar, position, total);

  return Val_unit;
}
开发者ID:noxdafox,项目名称:libguestfs,代码行数:13,代码来源:progress-c.c

示例6: brlapiml_acceptKeyRanges

CAMLprim value brlapiml_acceptKeyRanges(value handle, value camlRanges)
{
  CAMLparam2(handle, camlRanges);
  CAMLlocal1(r);
  unsigned int i, size = Wosize_val(camlRanges);
  brlapi_range_t ranges[size];
  for (i=0; i<size; i++) {
    r = Field(camlRanges, i);
    ranges[i].first = Int64_val(Field(r, 0));
    ranges[i].last = Int64_val(Field(r, 1));
  }
  brlapiCheckError(acceptKeyRanges, ranges, size);
  CAMLreturn(Val_unit);
}
开发者ID:Feechka,项目名称:UOBP,代码行数:14,代码来源:brlapi_stubs.c

示例7: tigertree_unsafe64_fd

value tigertree_unsafe64_fd (value digest_v, value fd_v, value pos_v, value len_v)
{
  OS_FD fd = Fd_val(fd_v);
  OFF_T pos = Int64_val(pos_v);
  OFF_T len = Int64_val(len_v);
  unsigned char *digest = String_val(digest_v);
/*  int nread; */

  os_lseek(fd, pos, SEEK_SET);

  tiger_tree_fd(fd, len, 0, tiger_block_size(len), digest);

  return Val_unit;
}
开发者ID:LuoZijun,项目名称:mldonkey,代码行数:14,代码来源:stubs_c.c

示例8: stub_blk_read

CAMLprim value stub_blk_read(value sector, value buffer, value num) {
    CAMLparam3(sector, buffer, num);
    uint64_t sec = Int64_val(sector);
    uint8_t *data = Caml_ba_data_val(buffer);
    int n = Int_val(num);
    int ret = 0;

    assert(Caml_ba_array_val(buffer)->num_dims == 1);

    //printf("Solo5 blk read: sec=%d num=%d\n", sec, n);

    ret = solo5_blk_read_sync(sec, data, &n);
    if ( ret )
        printf("virtio read failed... %d from sector=%d\n", n, sec);

#if 0
    {
        int i;
        for (i = 0; i < n; i++) {
            printf("%02x ", (uint8_t) data[i]);
            if ( i % 16 == 15 )
                printf("\n");
        }
        printf("\n");
    }
#endif

    CAMLreturn(Val_bool(!ret));
}
开发者ID:hannesm,项目名称:mirage-solo5,代码行数:29,代码来源:solo5_block_stubs.c

示例9: stub_sendfile64

CAMLprim value stub_sendfile64(value in_fd, value out_fd, value len){
  CAMLparam3(in_fd, out_fd, len);
  CAMLlocal1(result);
  size_t c_len = Int64_val(len);
  size_t bytes;
  int c_in_fd = Int_val(in_fd);
  int c_out_fd = Int_val(out_fd);

  int rc = NOT_IMPLEMENTED;

  enter_blocking_section();

#ifdef __linux__
  rc = TRIED_AND_FAILED;
  bytes = sendfile(c_out_fd, c_in_fd, NULL, c_len);
  if (bytes != -1) rc = OK;
#endif

  leave_blocking_section();

  switch (rc) {
    case NOT_IMPLEMENTED:
      caml_failwith("This platform does not support sendfile()");
      break;
    case TRIED_AND_FAILED:
      uerror("sendfile", Nothing);
      break;
    default: break;
  }
  result = caml_copy_int64(bytes);
  CAMLreturn(result);
}
开发者ID:djs55,项目名称:vhd-tool,代码行数:32,代码来源:sendfile64_stubs.c

示例10: c_sprint_int64

value
c_sprint_int64(value s, value index, value x) {
  CAMLparam3 (s, index, x);
  int64_t *p = (int64_t*) (String_val(s) + Int_val(index));
  *p = (int64_t)Int64_val(x);
  CAMLreturn (Val_unit);
}
开发者ID:AE4317group07,项目名称:paparazzi,代码行数:7,代码来源:convert.c

示例11: uwt_lseek

/*
  lseek is used inside Uwt_io. Therefore, I can't be seperated like the other
  unix functions
*/
CAMLprim value
uwt_lseek(value o_fd, value o_pos, value o_mode, value o_loop, value o_cb)
{
  CAMLparam1(o_cb);
  int erg;
  uv_loop_t * loop = Uv_loop_val(o_loop);
  const int fd = FD_VAL(o_fd);
  const int64_t offset = Int64_val(o_pos);
  const int whence = seek_command_table[ Long_val(o_mode) ];

  GR_ROOT_ENLARGE();
  value o_ret;
  struct req * req = uwt__req_create_res(UV_WORK, &o_ret);
  req->buf.len = (size_t)fd;
  req->offset = whence;
  req->c_cb = lseek_cb;
  int64_t_to_voids(offset,&req->c);
  erg = uv_queue_work(loop, (uv_work_t*)req->req, lseek_work_cb, uwork_cb);
  if ( erg >= 0 ){
    uwt__gr_register(&req->cb,o_cb);
  }
  else {
    uwt__req_free(req);
    Field(o_ret,0) = Val_uwt_error(erg);
    Tag_val(o_ret) = Error_tag;
  }
  CAMLreturn(o_ret);
}
开发者ID:djs55,项目名称:uwt,代码行数:32,代码来源:uwt_stubs_worker.c

示例12: unix_lseek_64

CAMLprim value unix_lseek_64(value fd, value ofs, value cmd)
{
  __int64 ret;

  ret = caml_set_file_pointer(Handle_val(fd), Int64_val(ofs),
                              seek_command_table[Int_val(cmd)]);
  return copy_int64(ret);
}
开发者ID:OCamlPro,项目名称:OCamlPro-OCaml-Branch,代码行数:8,代码来源:lseek.c

示例13: caml_int64_float_of_bits

CAMLprim value caml_int64_float_of_bits(value vi)
{
  union { double d; int64 i; int32 h[2]; } u;
  u.i = Int64_val(vi);
#if defined(__arm__) && !defined(__ARM_EABI__)
  { int32 t = u.h[0]; u.h[0] = u.h[1]; u.h[1] = t; }
#endif
  return caml_copy_double(u.d);
}
开发者ID:dirkdokter,项目名称:pprz-installer-fedora,代码行数:9,代码来源:ints.c

示例14: brlapiml_acceptKeys

CAMLprim value brlapiml_acceptKeys(value handle, value rt, value camlKeys)
{
  CAMLparam3(handle, rt, camlKeys);
  unsigned int i, size = Wosize_val(camlKeys);
  brlapi_keyCode_t keys[size];
  for (i=0; i<size; i++) keys[i] = Int64_val(Field(camlKeys, i)); 
  brlapiCheckError(acceptKeys, Int_val(rt), keys, size);
  CAMLreturn(Val_unit);
}
开发者ID:Feechka,项目名称:UOBP,代码行数:9,代码来源:brlapi_stubs.c

示例15: ocaml_gstreamer_buffer_set_presentation_time

CAMLprim value ocaml_gstreamer_buffer_set_presentation_time(value _buf, value _t)
{
  CAMLparam2(_buf, _t);
  GstBuffer *b = Buffer_val(_buf);
  GstClockTime t = Int64_val(_t);

  b->pts = t;

  CAMLreturn(Val_unit);
}
开发者ID:gndl,项目名称:ocaml-gstreamer,代码行数:10,代码来源:gstreamer_stubs.c


注:本文中的Int64_val函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。