aboutsummaryrefslogtreecommitdiff
path: root/ivy.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ivy.ml')
-rw-r--r--ivy.ml14
1 files changed, 7 insertions, 7 deletions
diff --git a/ivy.ml b/ivy.ml
index f031252..d12ae6f 100644
--- a/ivy.ml
+++ b/ivy.ml
@@ -55,21 +55,21 @@ let hexa_code = fun c ->
let hexa_of_string = fun s ->
let n = String.length s in
- let h = String.create (n*2) in
+ let h = Bytes.create (n*2) in
for i = 0 to n - 1 do
let c = Char.code s.[i] in
- h.[2*i] <- hexa_char (c lsr 4);
- h.[2*i+1] <- hexa_char (c land 0xf)
+ Bytes.set h (2*i) (hexa_char (c lsr 4));
+ Bytes.set h (2*i+1) (hexa_char (c land 0xf))
done;
- h
+ Bytes.to_string h
let string_of_hexa = fun h ->
let n = String.length h / 2 in
- let s = String.create n in
+ let s = Bytes.create n in
for i = 0 to n - 1 do
- s.[i] <- Char.chr (hexa_code h.[2*i] lsl 4 + hexa_code h.[2*i+1])
+ Bytes.set s i (Char.chr (hexa_code h.[2*i] lsl 4 + hexa_code h.[2*i+1]))
done;
- s
+ Bytes.to_string s
let send_data = fun tag value ->