# endian-blob `endian-blob` is a library of endian-specific procedures for converting blobs to numeric values and vectors. ## Predicates and constants (endian-blob? X) => BOOL Returns {{#t}} if the given object is an endian blob, {{#f}} otherwise. * {{MSB}} * {{LSB}} These constants specify most-significant or least-significant byte order, respectively. ## Converting to and from byte blobs (byte-blob->endian-blob BYTE-BLOB BYTE-ORDER) Returns an endian blob containing the given byte-blob. Argument {{BYTE-ORDER}} is one of {{MSB}} or {{LSB}}. ## Converting to and from numbers and numeric vectors (endian-blob->sint1 ENDIAN-BLOB) => NUMBER
(endian-blob->sint2 ENDIAN-BLOB) => NUMBER
(endian-blob->sint4 ENDIAN-BLOB) => NUMBER
(sint1->endian-blob NUMBER [* MODE]) => ENDIAN-BLOB
(sint2->endian-blob NUMBER [* MODE]) => ENDIAN-BLOB
(sint4->endian-blob NUMBER [* MODE]) => ENDIAN-BLOB
These procedures convert between endian blobs and signed integers of size 1, 2, or 4 bytes, respectively. Exceptions are thrown if the given endian blobs are of incorrect size, or if the given numbers are too big to fit in the specified size. Optional argument {{MODE}} indicates the endianness of the resulting endian blob and can be one of {{MSBB}} or {{LSB}}. Default is {{MSB}}. (endian-blob->uint1 ENDIAN-BLOB) => NUMBER
(endian-blob->uint2 ENDIAN-BLOB) => NUMBER
(endian-blob->uint4 ENDIAN-BLOB) => NUMBER
(uint1->endian-blob NUMBER [* MODE]) => ENDIAN-BLOB
(uint2->endian-blob NUMBER [* MODE]) => ENDIAN-BLOB
(uint4->endian-blob NUMBER [* MODE]) => ENDIAN-BLOB
These procedures convert between endian blobs and unsigned integers of size 1, 2, or 4 bytes, respectively. Exceptions are thrown if the given endian blobs are of incorrect size, or if the given numbers are too big to fit in the specified size. Optional argument {{MODE}} indicates the endianness of the resulting endian blob and can be one of {{MSBB}} or {{LSB}}. Default is {{MSB}}. (endian-blob->ieee_float32 ENDIAN-BLOB) => NUMBER
(endian-blob->ieee_float64 ENDIAN-BLOB) => NUMBER
(ieee_float32->endian-blob NUMBER [* MODE]) => ENDIAN-BLOB
(ieee_float64->endian-blob NUMBER [* MODE]) => ENDIAN-BLOB
These procedures convert between endian blobs and IEEE floating point numbers of single or double precision, respectively. Exceptions are thrown if the given endian blobs are of incorrect size, or if the given numbers are too big to fit in the specified size. Optional argument {{MODE}} indicates the endianness of the resulting endian blob and can be one of {{MSBB}} or {{LSB}}. Default is {{MSB}}. (endian-blob->s8vector ENDIAN-BLOB) => S8VECTOR
(endian-blob->s16vector ENDIAN-BLOB) => S16VECTOR
(endian-blob->s32vector ENDIAN-BLOB) => S32VECTOR
(endian-blob->u8vector ENDIAN-BLOB) => U8VECTOR
(endian-blob->u16vector ENDIAN-BLOB) => U16VECTOR
(endian-blob->u32vector ENDIAN-BLOB) => U32VECTOR
(endian-blob->f32vector ENDIAN-BLOB) => F32VECTOR
(endian-blob->f64vector ENDIAN-BLOB) => F64VECTOR
(s8vector->endian-blob S8VECTOR [* MODE]) => ENDIAN-BLOB
(s16vector->endian-blob S16VECTOR [* MODE]) => ENDIAN-BLOB
(s32vector->endian-blob S32VECTOR [* MODE]) => ENDIAN-BLOB
(u8vector->endian-blob U8VECTOR [* MODE]) => ENDIAN-BLOB
(u16vector->endian-blob U16VECTOR [* MODE]) => ENDIAN-BLOB
(u32vector->endian-blob U32VECTOR [* MODE]) => ENDIAN-BLOB
(f32vector->endian-blob F32VECTOR [* MODE]) => ENDIAN-BLOB
(f64vector->endian-blob F64VECTOR [* MODE]) => ENDIAN-BLOB
These procedures convert between endian blobs and the corresponding SRFI-4 vector type. Optional argument {{MODE}} indicates the endianness of the resulting endian blob and can be one of {{MSBB}} or {{LSB}}. Default is {{MSB}}. ## Version History * 1.4 Removed dependency on ansidecl.h (thanks to Peter Bex) * 1.3 Added procedure endian-blob-length * 1.2 Fixed a bug in uint2->endian-blob (thanks to Shawn Rutledge) * 1.1 Some small optimizations * 1.0 Initial release ## License > Copyright 2009-2019 Ivan Raikov. > > endian-blob is based on routines from the C++ advanced I/O library and > TIFF reader written by Oleg Kiselyov, as well as the floating-point > I/O routines from GDB. > > This program is free software: you can redistribute it and/or modify > it under the terms of the GNU General Public License as published by > the Free Software Foundation, either version 3 of the License, or (at > your option) any later version. > > This program is distributed in the hope that it will be useful, but > WITHOUT ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for more details. > > A full copy of the GPL license can be found at > . >