121 lines
8.9 KiB
HTML
121 lines
8.9 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<!-- This manual documents Guile version 3.0.10.
|
||
|
|
||
|
Copyright (C) 1996-1997, 2000-2005, 2009-2023 Free Software Foundation,
|
||
|
Inc.
|
||
|
|
||
|
Copyright (C) 2021 Maxime Devos
|
||
|
|
||
|
Copyright (C) 2024 Tomas Volf
|
||
|
|
||
|
|
||
|
Permission is granted to copy, distribute and/or modify this document
|
||
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||
|
any later version published by the Free Software Foundation; with no
|
||
|
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
|
||
|
copy of the license is included in the section entitled "GNU Free
|
||
|
Documentation License." -->
|
||
|
<title>Bytevectors and Integer Lists (Guile Reference Manual)</title>
|
||
|
|
||
|
<meta name="description" content="Bytevectors and Integer Lists (Guile Reference Manual)">
|
||
|
<meta name="keywords" content="Bytevectors and Integer Lists (Guile Reference Manual)">
|
||
|
<meta name="resource-type" content="document">
|
||
|
<meta name="distribution" content="global">
|
||
|
<meta name="Generator" content=".texi2any-real">
|
||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
|
|
||
|
<link href="index.html" rel="start" title="Top">
|
||
|
<link href="Concept-Index.html" rel="index" title="Concept Index">
|
||
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||
|
<link href="Bytevectors.html" rel="up" title="Bytevectors">
|
||
|
<link href="Bytevectors-as-Floats.html" rel="next" title="Bytevectors as Floats">
|
||
|
<link href="Bytevectors-as-Integers.html" rel="prev" title="Bytevectors as Integers">
|
||
|
<style type="text/css">
|
||
|
<!--
|
||
|
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
|
||
|
div.example {margin-left: 3.2em}
|
||
|
span:hover a.copiable-link {visibility: visible}
|
||
|
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
|
||
|
-->
|
||
|
</style>
|
||
|
<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css">
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body lang="en">
|
||
|
<div class="subsubsection-level-extent" id="Bytevectors-and-Integer-Lists">
|
||
|
<div class="nav-panel">
|
||
|
<p>
|
||
|
Next: <a href="Bytevectors-as-Floats.html" accesskey="n" rel="next">Interpreting Bytevector Contents as Floating Point Numbers</a>, Previous: <a href="Bytevectors-as-Integers.html" accesskey="p" rel="prev">Interpreting Bytevector Contents as Integers</a>, Up: <a href="Bytevectors.html" accesskey="u" rel="up">Bytevectors</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
||
|
</div>
|
||
|
<hr>
|
||
|
<h4 class="subsubsection" id="Converting-Bytevectors-to_002ffrom-Integer-Lists"><span>6.6.12.4 Converting Bytevectors to/from Integer Lists<a class="copiable-link" href="#Converting-Bytevectors-to_002ffrom-Integer-Lists"> ¶</a></span></h4>
|
||
|
|
||
|
<p>Bytevector contents can readily be converted to/from lists of signed or
|
||
|
unsigned integers:
|
||
|
</p>
|
||
|
<div class="example lisp">
|
||
|
<pre class="lisp-preformatted">(bytevector->sint-list (u8-list->bytevector (make-list 4 255))
|
||
|
(endianness little) 2)
|
||
|
⇒ (-1 -1)
|
||
|
</pre></div>
|
||
|
|
||
|
<dl class="first-deffn">
|
||
|
<dt class="deffn" id="index-bytevector_002d_003eu8_002dlist"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">bytevector->u8-list</strong> <var class="def-var-arguments">bv</var><a class="copiable-link" href="#index-bytevector_002d_003eu8_002dlist"> ¶</a></span></dt>
|
||
|
<dt class="deffnx def-cmd-deffn" id="index-scm_005fbytevector_005fto_005fu8_005flist"><span class="category-def">C Function: </span><span><strong class="def-name">scm_bytevector_to_u8_list</strong> <var class="def-var-arguments">(bv)</var><a class="copiable-link" href="#index-scm_005fbytevector_005fto_005fu8_005flist"> ¶</a></span></dt>
|
||
|
<dd><p>Return a newly allocated list of unsigned 8-bit integers from the
|
||
|
contents of <var class="var">bv</var>.
|
||
|
</p></dd></dl>
|
||
|
|
||
|
<a class="anchor" id="x_002du8_002dlist_002d_003ebytevector"></a><dl class="first-deffn">
|
||
|
<dt class="deffn" id="index-u8_002dlist_002d_003ebytevector"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">u8-list->bytevector</strong> <var class="def-var-arguments">lst</var><a class="copiable-link" href="#index-u8_002dlist_002d_003ebytevector"> ¶</a></span></dt>
|
||
|
<dt class="deffnx def-cmd-deffn" id="index-scm_005fu8_005flist_005fto_005fbytevector"><span class="category-def">C Function: </span><span><strong class="def-name">scm_u8_list_to_bytevector</strong> <var class="def-var-arguments">(lst)</var><a class="copiable-link" href="#index-scm_005fu8_005flist_005fto_005fbytevector"> ¶</a></span></dt>
|
||
|
<dd><p>Return a newly allocated bytevector consisting of the unsigned 8-bit
|
||
|
integers listed in <var class="var">lst</var>.
|
||
|
</p></dd></dl>
|
||
|
|
||
|
<dl class="first-deffn">
|
||
|
<dt class="deffn" id="index-bytevector_002d_003euint_002dlist"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">bytevector->uint-list</strong> <var class="def-var-arguments">bv endianness size</var><a class="copiable-link" href="#index-bytevector_002d_003euint_002dlist"> ¶</a></span></dt>
|
||
|
<dt class="deffnx def-cmd-deffn" id="index-scm_005fbytevector_005fto_005fuint_005flist"><span class="category-def">C Function: </span><span><strong class="def-name">scm_bytevector_to_uint_list</strong> <var class="def-var-arguments">(bv, endianness, size)</var><a class="copiable-link" href="#index-scm_005fbytevector_005fto_005fuint_005flist"> ¶</a></span></dt>
|
||
|
<dd><p>Return a list of unsigned integers of <var class="var">size</var> bytes representing the
|
||
|
contents of <var class="var">bv</var>, decoded according to <var class="var">endianness</var>.
|
||
|
</p></dd></dl>
|
||
|
|
||
|
<dl class="first-deffn">
|
||
|
<dt class="deffn" id="index-bytevector_002d_003esint_002dlist"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">bytevector->sint-list</strong> <var class="def-var-arguments">bv endianness size</var><a class="copiable-link" href="#index-bytevector_002d_003esint_002dlist"> ¶</a></span></dt>
|
||
|
<dt class="deffnx def-cmd-deffn" id="index-scm_005fbytevector_005fto_005fsint_005flist"><span class="category-def">C Function: </span><span><strong class="def-name">scm_bytevector_to_sint_list</strong> <var class="def-var-arguments">(bv, endianness, size)</var><a class="copiable-link" href="#index-scm_005fbytevector_005fto_005fsint_005flist"> ¶</a></span></dt>
|
||
|
<dd><p>Return a list of signed integers of <var class="var">size</var> bytes representing the
|
||
|
contents of <var class="var">bv</var>, decoded according to <var class="var">endianness</var>.
|
||
|
</p></dd></dl>
|
||
|
|
||
|
<dl class="first-deffn">
|
||
|
<dt class="deffn" id="index-uint_002dlist_002d_003ebytevector"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">uint-list->bytevector</strong> <var class="def-var-arguments">lst endianness size</var><a class="copiable-link" href="#index-uint_002dlist_002d_003ebytevector"> ¶</a></span></dt>
|
||
|
<dt class="deffnx def-cmd-deffn" id="index-scm_005fuint_005flist_005fto_005fbytevector"><span class="category-def">C Function: </span><span><strong class="def-name">scm_uint_list_to_bytevector</strong> <var class="def-var-arguments">(lst, endianness, size)</var><a class="copiable-link" href="#index-scm_005fuint_005flist_005fto_005fbytevector"> ¶</a></span></dt>
|
||
|
<dd><p>Return a new bytevector containing the unsigned integers listed in
|
||
|
<var class="var">lst</var> and encoded on <var class="var">size</var> bytes according to <var class="var">endianness</var>.
|
||
|
</p></dd></dl>
|
||
|
|
||
|
<dl class="first-deffn">
|
||
|
<dt class="deffn" id="index-sint_002dlist_002d_003ebytevector"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">sint-list->bytevector</strong> <var class="def-var-arguments">lst endianness size</var><a class="copiable-link" href="#index-sint_002dlist_002d_003ebytevector"> ¶</a></span></dt>
|
||
|
<dt class="deffnx def-cmd-deffn" id="index-scm_005fsint_005flist_005fto_005fbytevector"><span class="category-def">C Function: </span><span><strong class="def-name">scm_sint_list_to_bytevector</strong> <var class="def-var-arguments">(lst, endianness, size)</var><a class="copiable-link" href="#index-scm_005fsint_005flist_005fto_005fbytevector"> ¶</a></span></dt>
|
||
|
<dd><p>Return a new bytevector containing the signed integers listed in
|
||
|
<var class="var">lst</var> and encoded on <var class="var">size</var> bytes according to <var class="var">endianness</var>.
|
||
|
</p></dd></dl>
|
||
|
|
||
|
</div>
|
||
|
<hr>
|
||
|
<div class="nav-panel">
|
||
|
<p>
|
||
|
Next: <a href="Bytevectors-as-Floats.html">Interpreting Bytevector Contents as Floating Point Numbers</a>, Previous: <a href="Bytevectors-as-Integers.html">Interpreting Bytevector Contents as Integers</a>, Up: <a href="Bytevectors.html">Bytevectors</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|