Skip to content

Commit 15c1345

Browse files
author
Vincent Bernardoff
committed
Added doc for BE/LE
1 parent 4638b6d commit 15c1345

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

lib/cstruct.mli

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,67 @@ val hexdump: t -> unit
136136
val debug: t -> string
137137

138138
module BE : sig
139+
140+
(** Get/set big-endian integers of various sizes. The second
141+
argument of those functions is the position relative to the
142+
current offset of the cstruct. *)
143+
139144
val get_uint16: t -> int -> uint16
145+
(** [get_uint16 cstr off] is the 16 bit long big-endian unsigned
146+
integer stored in [cstr] at offset [off]. *)
147+
140148
val get_uint32: t -> int -> uint32
149+
(** [get_uint32 cstr off] is the 32 bit long big-endian unsigned
150+
integer stored in [cstr] at offset [off]. *)
151+
141152
val get_uint64: t -> int -> uint64
153+
(** [get_uint64 cstr off] is the 64 bit long big-endian unsigned
154+
integer stored in [cstr] at offset [off]. *)
142155

143156
val set_uint16: t -> int -> uint16 -> unit
157+
(** [set_uint16 cstr off i] writes the 16 bit long big-endian
158+
unsigned integer [i] at offset [off] of [cstr]. *)
159+
144160
val set_uint32: t -> int -> uint32 -> unit
161+
(** [set_uint32 cstr off i] writes the 32 bit long big-endian
162+
unsigned integer [i] at offset [off] of [cstr]. *)
163+
145164
val set_uint64: t -> int -> uint64 -> unit
165+
(** [set_uint64 cstr off i] writes the 64 bit long big-endian
166+
unsigned integer [i] at offset [off] of [cstr]. *)
167+
146168
end
147169

148170
module LE : sig
171+
172+
(** Get/set little-endian integers of various sizes. The second
173+
argument of those functions is the position relative to the
174+
current offset of the cstruct. *)
175+
149176
val get_uint16: t -> int -> uint16
177+
(** [get_uint16 cstr off] is the 16 bit long little-endian unsigned
178+
integer stored in [cstr] at offset [off]. *)
179+
150180
val get_uint32: t -> int -> uint32
181+
(** [get_uint32 cstr off] is the 32 bit long little-endian unsigned
182+
integer stored in [cstr] at offset [off]. *)
183+
151184
val get_uint64: t -> int -> uint64
185+
(** [get_uint64 cstr off] is the 64 bit long little-endian unsigned
186+
integer stored in [cstr] at offset [off]. *)
152187

153188
val set_uint16: t -> int -> uint16 -> unit
189+
(** [set_uint16 cstr off i] writes the 16 bit long little-endian
190+
unsigned integer [i] at offset [off] of [cstr]. *)
191+
154192
val set_uint32: t -> int -> uint32 -> unit
193+
(** [set_uint32 cstr off i] writes the 32 bit long little-endian
194+
unsigned integer [i] at offset [off] of [cstr]. *)
195+
155196
val set_uint64: t -> int -> uint64 -> unit
197+
(** [set_uint64 cstr off i] writes the 64 bit long little-endian
198+
unsigned integer [i] at offset [off] of [cstr]. *)
199+
156200
end
157201

158202
(** {2 List of buffers} *)

0 commit comments

Comments
 (0)