Permalink
Browse files

[feature] libbase: Added i64L to Stuff.

  • Loading branch information...
nrs135 committed Sep 13, 2011
1 parent 732d845 commit 0e04090bdf808bb2a24e3fbb70ba49ac4589e9b2
Showing with 9 additions and 4 deletions.
  1. +5 −4 libbase/stuff.ml
  2. +4 −0 libbase/stuff.mli
View
@@ -156,8 +156,7 @@ struct
(((Char.code (S.get (s) (i+6))) lsl 8) land 0x000000000000ff00) lor
(((Char.code (S.get (s) (i+7))) ) land 0x00000000000000ff)
- let ldd s i =
- Int64.float_of_bits
+ let ldi64L s i =
(Int64.logor (Int64.logand (Int64.shift_left (Int64.of_int (Char.code (S.get (s) (i+7)))) 56) 0xff00000000000000L)
(Int64.logor (Int64.logand (Int64.shift_left (Int64.of_int (Char.code (S.get (s) (i+6)))) 48) 0x00ff000000000000L)
(Int64.logor (Int64.logand (Int64.shift_left (Int64.of_int (Char.code (S.get (s) (i+5)))) 40) 0x0000ff0000000000L)
@@ -167,8 +166,7 @@ struct
(Int64.logor (Int64.logand (Int64.shift_left (Int64.of_int (Char.code (S.get (s) (i+1)))) 8) 0x000000000000ff00L)
(Int64.logand ( (Int64.of_int (Char.code (S.get (s) (i+0)))) ) 0x00000000000000ffL))))))))
- let bdd s i =
- Int64.float_of_bits
+ let bdi64L s i =
(Int64.logor (Int64.logand (Int64.shift_left (Int64.of_int (Char.code (S.get (s) (i+0)))) 56) 0xff00000000000000L)
(Int64.logor (Int64.logand (Int64.shift_left (Int64.of_int (Char.code (S.get (s) (i+1)))) 48) 0x00ff000000000000L)
(Int64.logor (Int64.logand (Int64.shift_left (Int64.of_int (Char.code (S.get (s) (i+2)))) 40) 0x0000ff0000000000L)
@@ -178,6 +176,9 @@ struct
(Int64.logor (Int64.logand (Int64.shift_left (Int64.of_int (Char.code (S.get (s) (i+6)))) 8) 0x000000000000ff00L)
(Int64.logand ( (Int64.of_int (Char.code (S.get (s) (i+7)))) ) 0x00000000000000ffL))))))))
+ let ldd s i = Int64.float_of_bits (ldi64L s i)
+ let bdd s i = Int64.float_of_bits (bdi64L s i)
+
end (* module StuffF *)
module StuffString = StuffF(String)
View
@@ -40,6 +40,8 @@ module StuffF :
val bdi32 : S.t -> int -> int
val ldi64 : S.t -> int -> int
val bdi64 : S.t -> int -> int
+ val ldi64L : S.t -> int -> int64
+ val bdi64L : S.t -> int -> int64
val ldd : S.t -> int -> float
val bdd : S.t -> int -> float
end
@@ -60,6 +62,8 @@ module StuffString :
val bdi32 : string -> int -> int
val ldi64 : string -> int -> int
val bdi64 : string -> int -> int
+ val ldi64L : string -> int -> int64
+ val bdi64L : string -> int -> int64
val ldd : string -> int -> float
val bdd : string -> int -> float
end

0 comments on commit 0e04090

Please sign in to comment.