Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
taking a look at what set_size_unsafe would do.
- Loading branch information
Romain Slootmaekers
committed
Jun 1, 2012
1 parent
58938b5
commit 3de9ed0
Showing
4 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include <caml/memory.h> | ||
#include <caml/mlvalues.h> | ||
|
||
value Caml_set_size_unsafe(value v_buf, value v_size){ | ||
CAMLparam2(v_buf, v_size); | ||
char * buf = String_val(v_buf); | ||
int * ibuf = (int*) buf; | ||
int size = Long_val(v_size); | ||
ibuf[0] = size; | ||
CAMLreturn(Val_unit); | ||
} | ||
|
||
value Caml_size_from_unsafe(value v_buf, value v_pos){ | ||
CAMLparam2(v_buf,v_pos); | ||
char * buf = String_val(v_buf); | ||
int pos = Long_val(v_pos); | ||
int * ibuf = (int*) buf; | ||
int size = ibuf[pos]; | ||
value v_size = Val_long(size); | ||
CAMLreturn(v_size); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
external set_size_unsafe : string -> int -> unit = "Caml_set_size_unsafe" | ||
external size_from_unsafe: string -> int -> int = "Caml_size_from_unsafe" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ posix.o | |
bsd_crc32c.o | ||
arakoon_crc32c.o | ||
cpudetect.o | ||
baardskeerder_util.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters