formatting

This commit is contained in:
carm 2015-02-19 23:10:19 -05:00
parent 8d814d4feb
commit a1ca8ff831

View file

@ -29,10 +29,10 @@ module Array = struct
type t
val empty : t
val make: int -> elt -> t
val length: t -> int
val make: int -> elt -> t
val length: t -> int
val get: t -> int -> elt
@ -41,13 +41,13 @@ module Array = struct
val sub: t -> int -> int -> t
val copy : t -> t
val blit : t -> int -> t -> int -> int -> unit
val blit : t -> int -> t -> int -> int -> unit
val iter : (elt -> unit) -> t -> unit
end
module ByteArray :
module ByteArray :
S with type elt = char and type t = bytes = struct
type elt = char
include Bytes
@ -203,13 +203,13 @@ struct
let copy b =
{ b with buf=Array.copy b.buf; }
(*$T
let b = ByteBuffer.create 3 in \
let s = Bytes.of_string "hello world" in \
ByteBuffer.blit_from b s 0 (Bytes.length s); \
(*$T
let b = ByteBuffer.create 3 in \
let s = Bytes.of_string "hello world" in \
ByteBuffer.blit_from b s 0 (Bytes.length s); \
let b' = ByteBuffer.copy b in \
try ByteBuffer.iteri b (fun i c -> if ByteBuffer.get_front b' i <> c then raise Exit); true with Exit -> false
*)
*)
let capacity b = Array.length b.buf
@ -362,7 +362,7 @@ struct
(*$Q
(Q.pair Q.printable_string Q.printable_string) (fun (s,s') -> \
(let b = ByteBuffer.create 24 in ByteBuffer.blit_from b s 0 (Bytes.length s);
ByteBuffer.blit_from b s' 0 (Bytes.length s'); \
ByteBuffer.blit_from b s' 0 (Bytes.length s'); \
ByteBuffer.blit_from b "hello world" 0 (Bytes.length "hello word"); (* big enough *) \
let l = ByteBuffer.length b in let l' = l/2 in ByteBuffer.skip b l'; \
ByteBuffer.length b + l' = l))