PACK_WORD
signature
signature PACK_WORD
(* OPTIONAL *)
structure PackWord<N>Big
:> PACK_WORD (* OPTIONAL *)
structure PackWord<N>Little
:> PACK_WORD (* OPTIONAL *)
The PackWord<N>Big
and PackWord<N>Little
structures provide facilities for packing and unpacking N-bit word elements into Word8
vectors. This mechanism allows word values to be transmitted in binary format over networks. The PackWord<N>Big
structures perform big-endian packing and unpacking, while the PackWord<N>Little
structures perform little-endian packing and unpacking.
val bytesPerElem : int
val isBigEndian : bool
val subVec : Word8Vector.vector * int -> LargeWord.word
val subVecX : Word8Vector.vector * int -> LargeWord.word
val subArr : Word8Array.array * int -> LargeWord.word
val subArrX : Word8Array.array * int -> LargeWord.word
val update : Word8Array.array * int * LargeWord.word
-> unit
val bytesPerElem : int
bytesPerElem
that are small powers of two (e.g., 1, 2, 4, and 8, corresponding to N of 8, 16, 32, 64, respectively).
val isBigEndian : bool
subVec (vec, i)
subVecX (vec, i)
vec[bytesPerElem*i..bytesPerElem*(i+1)-1]of the vector vec and convert it into a word according to the endianness of the structure. The
subVecX
version extends the sign bit (most significant bit) when converting the subvector to a word. The functions raise the Subscript
exception if i < 0 or if Word8Vector.length
vec < bytesPerElem
* (i + 1).
subArr (arr, i)
subArrX (arr, i)
arr[bytesPerElem*i..bytesPerElem*(i+1)-1]of the array arr and convert it into a word according to the endianness of the structure. The
subArrX
version extends the sign bit (most significant bit) when converting the subarray into a word. The functions raise the Subscript
exception if i < 0 or if Word8Array.length
arr < bytesPerElem
* (i+1).
update (arr, i, w)
bytesPerElem
low-order bytes of the word w into the bytes bytesPerElem
*i
through bytesPerElem
*(i+1)-1
of the array arr, according to the structure's endianness. It raises the Subscript
exception if i < 0 or if Word8Array.length
arr < bytesPerElem
* (i+1).
Byte
,LargeWord
,MONO_ARRAY
,MONO_VECTOR
,PACK_REAL
Generated April 12, 2004
Last Modified May 29, 2000
Comments to John Reppy.
This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.
Copyright © 2004 AT&T and Lucent Technologies. All rights reserved.
Permission is granted for internet users to make one paper copy for their
own personal use. Further hardcopy reproduction is strictly prohibited.
Permission to distribute the HTML document electronically on any medium
other than the internet must be requested from the copyright holders by
contacting the editors.
Printed versions of the SML Basis Manual are available from Cambridge
University Press.
To order, please visit
www.cup.org (North America) or
www.cup.cam.ac.uk (outside North America). |