1
0
Fork 0
cl-sites/guile.html_node/Bytevector-Endianness.html
2024-12-17 12:49:28 +01:00

109 lines
5.7 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>Bytevector Endianness (Guile Reference Manual)</title>
<meta name="description" content="Bytevector Endianness (Guile Reference Manual)">
<meta name="keywords" content="Bytevector Endianness (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="Bytevector-Manipulation.html" rel="next" title="Bytevector Manipulation">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
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="Bytevector-Endianness">
<div class="nav-panel">
<p>
Next: <a href="Bytevector-Manipulation.html" accesskey="n" rel="next">Manipulating Bytevectors</a>, Up: <a href="Bytevectors.html" accesskey="u" rel="up">Bytevectors</a> &nbsp; [<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="Endianness"><span>6.6.12.1 Endianness<a class="copiable-link" href="#Endianness"> &para;</a></span></h4>
<a class="index-entry-id" id="index-endianness"></a>
<a class="index-entry-id" id="index-byte-order"></a>
<a class="index-entry-id" id="index-word-order"></a>
<p>Some of the following procedures take an <var class="var">endianness</var> parameter.
The <em class="dfn">endianness</em> is defined as the order of bytes in multi-byte
numbers: numbers encoded in <em class="dfn">big endian</em> have their most
significant bytes written first, whereas numbers encoded in
<em class="dfn">little endian</em> have their least significant bytes
first<a class="footnote" id="DOCF10" href="#FOOT10"><sup>10</sup></a>.
</p>
<p>Little-endian is the native endianness of the IA32 architecture and
its derivatives, while big-endian is native to SPARC and PowerPC,
among others. The <code class="code">native-endianness</code> procedure returns the
native endianness of the machine it runs on.
</p>
<dl class="first-deffn">
<dt class="deffn" id="index-native_002dendianness"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">native-endianness</strong><a class="copiable-link" href="#index-native_002dendianness"> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-scm_005fnative_005fendianness"><span class="category-def">C Function: </span><span><strong class="def-name">scm_native_endianness</strong> <var class="def-var-arguments">()</var><a class="copiable-link" href="#index-scm_005fnative_005fendianness"> &para;</a></span></dt>
<dd><p>Return a value denoting the native endianness of the host machine.
</p></dd></dl>
<dl class="first-deffn">
<dt class="deffn" id="index-endianness-1"><span class="category-def">Scheme Macro: </span><span><strong class="def-name">endianness</strong> <var class="def-var-arguments">symbol</var><a class="copiable-link" href="#index-endianness-1"> &para;</a></span></dt>
<dd><p>Return an object denoting the endianness specified by <var class="var">symbol</var>. If
<var class="var">symbol</var> is neither <code class="code">big</code> nor <code class="code">little</code> then an error is
raised at expand-time.
</p></dd></dl>
<dl class="first-defvr">
<dt class="defvr" id="index-scm_005fendianness_005fbig"><span class="category-def">C Variable: </span><span><strong class="def-name">scm_endianness_big</strong><a class="copiable-link" href="#index-scm_005fendianness_005fbig"> &para;</a></span></dt>
<dt class="defvrx def-cmd-defvr" id="index-scm_005fendianness_005flittle"><span class="category-def">C Variable: </span><span><strong class="def-name">scm_endianness_little</strong><a class="copiable-link" href="#index-scm_005fendianness_005flittle"> &para;</a></span></dt>
<dd><p>The objects denoting big- and little-endianness, respectively.
</p></dd></dl>
</div>
<div class="footnotes-segment">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>
<h5 class="footnote-body-heading"><a id="FOOT10" href="#DOCF10">(10)</a></h5>
<p>Big-endian and little-endian are the most common
&ldquo;endiannesses&rdquo;, but others do exist. For instance, the GNU MP
library allows <em class="dfn">word order</em> to be specified independently of
<em class="dfn">byte order</em> (see <a data-manual="gmp" href="https://www.gmplib.org/manual/Integer-Import-and-Export.html#Integer-Import-and-Export">Integer Import and Export</a> in <cite class="cite">The GNU
Multiple Precision Arithmetic Library Manual</cite>).</p>
</div>
</body>
</html>