From d55c958ca5df106738f6b8654716c93116c1ea4f Mon Sep 17 00:00:00 2001 From: bemandawes Date: Fri, 27 May 2011 19:37:11 +0000 Subject: [PATCH] Start work on docs git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@72226 b8fc166d-592f-0410-95f2-cb63ce0dd405 --- libs/endian/doc/index.html | 202 ++++++++++++++++++ libs/endian/doc/{integers.html => types.html} | 9 +- libs/endian/index.html | 14 ++ 3 files changed, 220 insertions(+), 5 deletions(-) create mode 100644 libs/endian/doc/index.html rename libs/endian/doc/{integers.html => types.html} (98%) create mode 100644 libs/endian/index.html diff --git a/libs/endian/doc/index.html b/libs/endian/doc/index.html new file mode 100644 index 0000000..8326f05 --- /dev/null +++ b/libs/endian/doc/index.html @@ -0,0 +1,202 @@ + + + + + + + +Boost Endian Library + + + + + + + + + + +
+ +boost.png (6897 bytes) + Endian Library
+ + + + + +
Boost Home  Conversion Reference + Types Reference Tutorial
+ +

Introduction

+ +

The Boost Endian Library provides facilities to deal with endianness. See +Introduction to endianness below for +the basics of endianness.

+ +

The library provides two approaches to dealing with integer endianness:

+ +
+ +

Endian conversions for native integers - The application uses the +built-in integer types, and calls the provided conversion functions to swap +bytes as needed. Both mutating and non-mutating conversions are supplied, and +each comes in unconditional and conditional variants. This approach is simple +and efficient, but is less flexible in terms of size and alignment, and can be +hard to manage in code with many logical paths involving endianness transitions.

+ +

Endian integer types

+ +
+ +

Introduction to endianness

+ +

Consider a C++ program that defines variables x, y, and z as 16, 32, and +64-bit integers, respectively. There are several ways a processor might layout +the individual bytes for these variables in memory:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
int16_t x = 0x0A0B;
Big EndianLittle Endian
Value0A0BValue0B0A
Address...0...1Address...0...1
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t y = 0x0A0B0C0D;
Big EndianLittle Endian
Value0A0B0C0DValue0D0C0B0A
Address...0...1...2...3Address...0...1...2...3
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int64_t z = 0x0A0B0C0D0E0F0102;
Big EndianLittle Endian
Value0A0B0C0D0E0F0102Value02010F0E0D0C0B0A
Address...0...1...2...3...4...5...6...7Address...0...1...2...3...4...5...6...7
+ +

The most-significant byte first ordering is traditionally called "big endian" +ordering and the least-significant byte first is traditionally called +"little-endian" ordering. Although some other orderings are possible, most +modern uses are as shown above. The names are derived from + +Jonathan Swift's satirical novel + +Gulliver’s Travels, where rival kingdom's opened their soft-boiled eggs +at different ends.

+ +

Intel processors are traditionally little endian while many others are big +endian. Some processors can switch endianness, so which is in use depends on the +operating system. The Wikipedia's +Endianness entry lists +details for many processors and operating systems.

+ +

External memory, such as disks, generally uses the same endianness as the +operating system. Networks traditionally use big endian ordering, so this is +sometimes referred as network endianness.

+
+

Last revised: +27 May, 2011

+

© Copyright Beman Dawes, 2011

+

Distributed under the Boost Software License, Version 1.0. See +www.boost.org/ LICENSE_1_0.txt

+ +

 

+ + + + \ No newline at end of file diff --git a/libs/endian/doc/integers.html b/libs/endian/doc/types.html similarity index 98% rename from libs/endian/doc/integers.html rename to libs/endian/doc/types.html index 0cd0893..d968153 100644 --- a/libs/endian/doc/integers.html +++ b/libs/endian/doc/types.html @@ -6,7 +6,7 @@ Boost Endian Integers - + @@ -653,11 +653,10 @@ Tomas Puverle, Vincente Botet, and Yuval Ronen.


Last revised: -25 March, 2009

+27 May, 2011

© Copyright Beman Dawes, 2006-2009

-

Distributed under the Boost Software License, Version 1.0. (See accompanying -file LICENSE_1_0.txt or copy at -www.boost.org/ LICENSE_1_0.txt)

+

Distributed under the Boost Software License, Version 1.0. See +www.boost.org/ LICENSE_1_0.txt

diff --git a/libs/endian/index.html b/libs/endian/index.html new file mode 100644 index 0000000..3ebbb5a --- /dev/null +++ b/libs/endian/index.html @@ -0,0 +1,14 @@ + + + + + +Automatic redirection failed, please go to +doc/index.html
+

© Copyright Beman Dawes, 2001

+

Distributed under the Boost Software License, Version 1.0. +(See www.boost.org/LICENSE_1_0.txt) + +

+ + \ No newline at end of file