本文整理汇总了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
}
示例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);
}
示例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));
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}