mirror of
https://github.com/boostorg/endian.git
synced 2026-07-09 10:00:52 +02:00
280 lines
13 KiB
HTML
280 lines
13 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Language" content="en-us">
|
|
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
|
|
<meta name="ProgId" content="FrontPage.Editor.Document">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
|
<title>Endian Library Do List</title>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Endian Library Do List</h1>
|
|
<h2>To Do</h2>
|
|
<ul>
|
|
<li>Re-read all messages, and extract Acknowledgements and revise TODO list.</li>
|
|
<li>Develop the use-cases example programs, using plain integers and UDT's.
|
|
</li>
|
|
<li>Apply revised conversion functions to the example programs. Iterate until
|
|
happy.</li>
|
|
<li>Apply the integers to the example programs, and also see if using<br>
|
|
the revised conversion functions to implement some or all of the<br>
|
|
integers.</li>
|
|
<li>Apply mockups of the buffers to the example programs, to get a<br>
|
|
firmer idea if the buffer idea actually seems to do be worthwhile in<br>
|
|
practice.</li>
|
|
<li>Post work-in-progress for feedback.</li>
|
|
<li>boost-root/boost/detail/endian.hpp: Boost.Endian should provide identical
|
|
functionality in a Boost license only header. That implies rewriting the
|
|
portions covered by the original SGI copyright. The boost-root/boost/detail/endian.hpp
|
|
header should be changed to forward to the Boost.Endian header to preserve
|
|
existing code, and the SGI copyright thus eliminated.</li>
|
|
<li>Finalize and hold mini-review.</li>
|
|
</ul>
|
|
<h2>Format Review Comments</h2>
|
|
<h3 dir="ltr">Votes</h3>
|
|
<ul>
|
|
<li dir="ltr">
|
|
<p dir="ltr">John Filo - "Absolutely. I'd like to see support for float and
|
|
double, but<br>
|
|
even without those additions, I still vote yes." "For those who deal with
|
|
non-native endian data, this library is<br>
|
|
extremely useful. It automatically eliminates a whole class of common<br>
|
|
programming errors when dealing with such data."<br>
|
|
</li>
|
|
<li dir="ltr">
|
|
<p dir="ltr">Hartmut Kaiser - "Even if this is not a full review, I would like
|
|
to vote YES to include this <br>
|
|
library into Boost.
|
|
<p>Boost.Spirit is using (and shipping) with an older version of this library
|
|
<br>
|
|
for several years now and we never had any problems with its usage in <br>
|
|
Spirit. It is used as the underlying framework for the binary parsers and <br>
|
|
generators and it is functioning as advertised.</p>
|
|
<p>As a quick test I replaced the internal (older) version of Boost.Endian in
|
|
<br>
|
|
Spirit with the reviewed version. All of Spirits regression tests still <br>
|
|
pass. "<br>
|
|
</li>
|
|
<li dir="ltr">
|
|
<p dir="ltr">Robert Stewart - "There are issues that keep me from saying yes
|
|
at this time. There are too many suggested variations and ideas under
|
|
consideration to accept the library in its present state. However, a
|
|
mini-review should be sufficient to evaluate the final form, once Beman
|
|
determines a course of action, and determine whether to accept it or not."<br>
|
|
</li>
|
|
<li dir="ltr">
|
|
<p dir="ltr">Tim Blechmann - "the library should be accepted, if<br>
|
|
<br>
|
|
(a) the interface of the conversion functions is changed<br>
|
|
(b) the performance can be improved<br>
|
|
(c) the documentation integrates better with the rest of the boost<br>
|
|
documentation."<br>
|
|
</li>
|
|
<li dir="ltr">
|
|
<p dir="ltr">Vicente J. Botet Escriba - "No in its current state.<br>
|
|
Once the library takes in account the requested modification (that Beman has
|
|
already accepted) a mini-review will be necessary to improve the library
|
|
before release."</li>
|
|
</ul>
|
|
<h3>Executive summary</h3>
|
|
<ul>
|
|
<li>Common use case scenarios should be developed.</li>
|
|
<li>Example programs should be developed for the common use case scenarios.</li>
|
|
<li>Documentation should illuminate the differences between endian
|
|
integer/float type and endian conversion approaches to the common use case
|
|
scenarios, and provide guidelines for choosing the most appropriate approach
|
|
for user's applications.</li>
|
|
<li>Conversion functions supplying results via <code>return</code> should be
|
|
provided.</li>
|
|
<li>Platform specific performance enhancements such as use of compiler
|
|
intrinsics or relaxed alignment requirements should be supported.</li>
|
|
<li>Endian integer (and floating) types should be implemented via the
|
|
conversion functions. If that can't be done efficiently, consideration should
|
|
be given to expanding the conversion function signatures to resolve the
|
|
inefficiencies.</li>
|
|
<li>Benchmarks that measure performance should be provided. It should be
|
|
possible to compare platform specific performance enhancements against
|
|
portable base implementations, and to compare endian integer approaches
|
|
against endian conversion approaches for the common use case scenarios.</li>
|
|
<li>Float (32-bits) and double (64-bits) should be supported. IEEE 754 is the
|
|
primary use case.</li>
|
|
<li>Support for user defined types (UDTs) is desirable, and should be
|
|
supported where there would be no conflict with the other concerns.</li>
|
|
<li>There is some concern that endian integer/float arithmetic operations
|
|
might used
|
|
inadvertently or inappropriately. The impact of adding an endian_buffer class without arithmetic
|
|
operations should be investigated.</li>
|
|
<li>Stream insertion and extraction of the endian integer/float types should
|
|
be documented and included in the test coverage.</li>
|
|
<li>Binary I/O support that was investigated during development of the Endian
|
|
library should be put up for min-review for inclusion in the Boost I/O
|
|
library.</li>
|
|
</ul>
|
|
<h3>Docs</h3>
|
|
<ul>
|
|
<li>Document use of endian integers with stream inserters and extractors.</li>
|
|
<li>Either add tutorial or remove from menu bar.</li>
|
|
<li>Conversion in note mention similarity to htonl() , etc.</li>
|
|
<li>Conversion: add discussion of alignment, packing, etc. Bottom line; use at
|
|
your own risk. Use Phil's example:<br>
|
|
struct S {<br>
|
|
uint16_t a;<br>
|
|
uint32_t b;<br>
|
|
} __attribute__ ((packed));</li>
|
|
<li>Requirements for template parameters. </li>
|
|
<li>UDTs<ul>
|
|
<li>Integers</li>
|
|
<li>Conversion</li>
|
|
</ul>
|
|
</li>
|
|
<li>Distinguish use cases and recommendations for which approach (integers vs
|
|
conversion) is appropriate.<ul>
|
|
<li><a href="http://lists.boost.org/Archives/boost/2011/09/185698.php">
|
|
http://lists.boost.org/Archives/boost/2011/09/185698.php</a></li>
|
|
</ul>
|
|
</li>
|
|
<li>> section `experience': this section gives no insights for people who use
|
|
or<br>
|
|
> read the code. it mainly tells: "we are not the first and the domain of the<br>
|
|
> library is important.". imo this section can be removed (maybe the part that<br>
|
|
> it is not related to any c library can go to the `design considerations'<br>
|
|
><br>
|
|
> section "motivating use cases": this is more a marketing blurb/testimonial.<br>
|
|
> maybe this could be changed to a section about possible use cases, listing<br>
|
|
> `communicating between different devices' and `reading/writing of binary
|
|
file<br>
|
|
> formats'.</li>
|
|
<li>one other point ... the help file seems to directly link to the c++
|
|
headers.<br>
|
|
this should be changed:<br>
|
|
<br>
|
|
* some browsers (at least chromium) will not display the header when clicking<br>
|
|
the link, but will save them on disk.<br>
|
|
<br>
|
|
* providing a direct link to the source code from the docs implies that the<br>
|
|
user will get some information that are necessary to use the library by<br>
|
|
reading the sources. imo, this is not the case for using boost.endian.<br>
|
|
<br>
|
|
* if a user opens integer.hpp, the first 60 lines just contain copyright, some<br>
|
|
historical notes, compiler-specific stuff, includes and ifdefs. imo, this is<br>
|
|
the implementation part, which should not be exposed to a user.<br>
|
|
<br>
|
|
so i'd suggest to completely remove the links to the c++ headers.<br>
|
|
</li>
|
|
<li>
|
|
<div class="im">
|
|
> explaining the other builting types are not considered. Why only
|
|
big/little<br>
|
|
> endianness has been taken in account?</div>
|
|
<p>I'll add FAQ and/or add more entries to the final docs.<br>
|
|
<br>
|
|
Only big/little endianness is taken into account because these are the<br>
|
|
only endian schemes that have any practical value. All the others are<br>
|
|
just historical curiosities.</li>
|
|
</ul>
|
|
<h3>Code</h3>
|
|
<p>Also change docs if applicable.</p>
|
|
<ul>
|
|
<li><span style="background-color: #FFCCFF">Beman: TODO</span><span style="background-color: #FFCCFF">:
|
|
</span><span style="background-color: #FFCCFF">Google</span><span style="background-color: #FFCCFF">
|
|
"unaligned integer", look at various entries. For example, http://</span><span style="background-color: #FFCCFF">infocenter.arm.com</span><span style="background-color: #FFCCFF">/help/</span><span style="background-color: #FFCCFF">index.jsp?topic</span><span style="background-color: #FFCCFF">=/</span><span style="background-color: #FFCCFF">com.arm.doc.faqs</span><span style="background-color: #FFCCFF">/ka3544.html</span></li>
|
|
<li>Merge conversion2 into conversion.hpp</li>
|
|
<li>Use builtins where applicable (GCC, possibly others)</li>
|
|
<li>Endian integer types should use the conversion functions where applicable.</li>
|
|
<li>Beman: Some platforms (compiler/processor taken together) don't require
|
|
alignment for the conversion functions if code is inlined, although speed may
|
|
suffer. (test to verify this assertion). On those platforms, conversion
|
|
functions (perhaps in-place) can be used to implement unaligned integers.<ul>
|
|
<li>Microsoft <a href="http://msdn.microsoft.com/en-us/library/ms253978.aspx">
|
|
UNALIGNED / __unaligned</a> keywords for pointers. Also
|
|
<a href="http://msdn.microsoft.com/en-us/library/ms253935.aspx">Packing
|
|
Structures</a>.</li>
|
|
<li>GCC
|
|
<a href="http://www.mailinglistarchive.com/gcc@gcc.gnu.org/msg21079.html">
|
|
http://www.mailinglistarchive.com/gcc@gcc.gnu.org/msg21079.html</a></li>
|
|
<li>Intel performs well on simple unaligned test. See
|
|
<a href="../test/unaligned_test.cpp">../test/unaligned_test.cpp</a></li>
|
|
</ul>
|
|
</li>
|
|
<li>Beman: Does the use of the unrolling templates get in the way of processor
|
|
specific optimization code?</li>
|
|
<li>Test use of endian integers with stream inserters and extractors.</li>
|
|
<li>Continue work on benchmarks and timings. Consider using use-case example
|
|
programs as benchmarks.</li>
|
|
<li>
|
|
<div class="im">
|
|
> The reorder fuction should provide both reorder in place and returned.</div>
|
|
<p>Interesting, but providing two ways of doing something is often<br>
|
|
considered the not best design practice. And the tests I've run so far<br>
|
|
don't indicate any efficiency concern. Once all other aspects of the<br>
|
|
interface and implementation are settled, let's revisit that question.<br>
|
|
</li>
|
|
<li>> The endianness scoped enum native should be replaced so it is defined<br>
|
|
> depending on the endianess of the platform.<br>
|
|
><br>
|
|
> BOOST_SCOPED_ENUM_START(<wbr />endianness) { big, little, native=(big or
|
|
little)<br>
|
|
> }; BOOST_SCOPED_ENUM_END<br>
|
|
><br>
|
|
> This will have the advantage to reduce of 1/3 the number of specializations.<br>
|
|
<br>
|
|
Does this work?<br>
|
|
</li>
|
|
<li dir="ltr">
|
|
<div class="im">
|
|
> The library should provide in addition endian conversion functions that
|
|
have<br>
|
|
> the endiannes as template parameters to make possible generic functions.</div>
|
|
<p dir="ltr">Compile time dispatch on an endianness enum was also requested in<br>
|
|
another review. That's fine with me, but I haven't had a chance to<br>
|
|
figure out the interface details.</li>
|
|
</ul>
|
|
<h3>Infrastructure</h3>
|
|
<ul>
|
|
<li>Remove scoped_enum_emulation_test stuff.</li>
|
|
<li>Remove timer stuff.</li>
|
|
<li>Use Boost.Timer.</li>
|
|
<li>
|
|
<div class="im">
|
|
> endian_operations_test.cpp and endian_in_union_test.cpp ... maybe rename
|
|
from<br>
|
|
> _test.cpp to _compile_test.cpp? they don't seem to do any run-time tests.
|
|
they<br>
|
|
> also should not include <cassert> since no assertion statement is needed,
|
|
this<br>
|
|
> might speed up the compilation time of the testsuite by something like
|
|
50ms ;)</div>
|
|
<p>Will do.</li>
|
|
<li>Make the bin() functionality available</li>
|
|
</ul>
|
|
<h3>Performance</h3>
|
|
<p> </p>
|
|
<h3>Acknowledge</h3>
|
|
<p>Gordon Woodhull, Hartmut Kaiser, Phil Endecott, tymofey, Giovanni Piero Deretta, Pyry Jahkola,
|
|
John Filo, Vitaly Budovski, Tomas Puverle, Vicente J. Botet Escriba, Tim
|
|
Blechmann, Daniel James, Mathias Gaunard, Adder, Tim Moore</p>
|
|
|
|
<p>Paul Bristow docs help </p>
|
|
|
|
<h2>Floating Point Support</h2>
|
|
|
|
<p>* Because FP formats vary, just dealing with endianness doesn't ensure<br>
|
|
portability.<br>
|
|
* The endianness of FP and integer values differs on some platforms,<br>
|
|
so we will have to build up a config file with separate entries for<br>
|
|
each platform, and that will take time to mature.<br>
|
|
* Ditto FP sizes.<br>
|
|
* I'm only willing to provide conversion.hpp FP support. Providing<br>
|
|
types that mimic FP types is far beyond my knowledge of how to deal<br>
|
|
with floating point's notorious arithmetic issues.</p>
|
|
<p>Support IEEE754 format (32 bit, 64 bit) only.</p>
|
|
<div class="im">
|
|
<br>
|
|
</div>
|
|
<p> </p>
|
|
|
|
</body>
|
|
|
|
</html> |