Commit Graph

155 Commits

Author SHA1 Message Date
Beman
1b0a41e6cb Add Clang/c2 solution with conversion_test_clang project. Clang/c2 uses the Microsoft rather than GCC intrinsics, so check for defined(_MSC_VER) before defined(__clang__) 2015-12-11 08:15:25 -05:00
Beman
f14f080359 Change the specification for native ordering to allow implementations to support orderings in addition to big and little. Thanks to Howard Hinnant for suggesting this change and providing draft wording. Also update headers to reflect actual inclusion hierarchy. 2015-10-16 10:30:34 -04:00
Beman
5c26514ded Add comment explaining omission of certain overloads. 2015-08-03 16:09:06 -04:00
Beman
01f7e359bb Update docs to reflect removal of floating point support from 1.58.0 2015-03-25 08:05:49 -04:00
Beman
5caf1d16c8 Remove floating point support for boost 1.58.0. As currently implemented, return by value operations are not reliable because normalization and other bit pattern changes can occur. Docs not updated as yet. Floating point support will be corrected and reinstated for boost 1.59.0, based on in-place customization and inplace and/or copy signatures to replace the unsafe (i.e. native_to_big/little ) by value returns. The big/little_to_native return by value functions are safe, but require reimplementation. 2015-03-24 17:24:56 -04:00
Beman
a15f9420cb Add fp_exhaustive_test. 2015-03-20 08:59:47 -04:00
Beman
e532e9c34d BOOST_TEST_MEM_EQ() macro returns bool to aid code that adds additional reporting on errors. 2015-03-20 07:41:54 -04:00
Beman
4f2a715c9f Fully implement float_value_test and double_value_test 2015-03-09 17:11:54 -04:00
Beman
09ae6c961f Rename BOOST_TEST_MEMCMP_EQ to BOOST_TEST_MEM_EQ. Add float_test to Jamfile. Add float_value_test() and double_value_test(). 2015-03-08 10:50:39 -04:00
Beman
072b495240 Add Endian specific lightweight_test.hpp with new macro BOOST_TEST_MEMCMP_EQ that uses std::memcmp(...)==0 to determine equality. Bitwise equality is the standard we want floating point round trips to be held to, since NaN's are then equal. 2015-03-05 10:52:28 -05:00
Beman
9c0cbae556 Revert the default (*_t) types to unaligned, and used *_at to identify the aligned types. See mini-review thread for rationale. 2015-02-23 07:24:17 -05:00
Beman
b6b03ea900 Fix incorrect header guard 2015-02-21 09:02:41 -05:00
Beman
b0ef03b9d6 Rearranges rows and columns in tables. Add big_int8_t, big_uint8_t, little_int8_t, little_uint8_t arithmetic and buffer types, in response to mini-review query. 2015-02-16 19:31:48 -05:00
Beman
adee2fe513 Add support for deprecated names from pre-review releases. 2015-01-18 19:48:27 -05:00
Beman
35f4c47a22 Add endian_buffer stream inserter and extractor, beef up buffer_test a bit. 2015-01-17 10:25:29 -05:00
Beman
321d5a087a For X86 and X64 architectures, which permit unaligned loads and stores, unaligned little endian buffer and arithmetic types use regular loads and stores when the size is exact. This makes unaligned little endian buffer and arithmetic types significantly more efficient on these architectures.(Pull request from Jeremy Maitin-Shepard) Docs updated, but timing results have not yet been updated. 2015-01-06 16:57:53 -05:00
Beman
d15b2fdb1c Refined rationale for choice of exact-length types for conversion support. 2014-12-16 08:49:01 -05:00
Beman
05ea08995c Pass through index.html making corrections and editorial changes. 2014-12-15 08:40:35 -05:00
Beman
971ba888d6 Decompose Reversible into EndianReversible and EndianReversibleInplace. 2014-12-11 11:41:44 -05:00
Beman
6c173766e3 Eliminate gcc -Wconversion warnings. 2014-12-10 15:03:06 -05:00
Beman
dcde9463fc Do not define _SCL_SECURE_NO_WARNINGS or _CRT_SECURE_NO_WARNINGS if already defined (such as on the command line), plus related cleanups. 2014-12-10 10:26:49 -05:00
Beman
c201455c84 Change "in_place" to "inplace". Rationale: shortens names without impacting expressiveness. 2014-12-10 09:39:03 -05:00
Beman
2cbcd6f7d3 Rename "runtime_conditional_reverse" to "conditional_reverse". The differing number of arguments is sufficient to disambiguate the compile-time and run-time overloads. 2014-12-10 09:26:47 -05:00
Beman
dcca2835a9 Rename "reverse_endianness" to "endian_reverse". Shorter but still plenty explicit. See bikeshed.txt for alternatives considered. 2014-12-10 08:30:30 -05:00
Beman
e4466edf4e Drop the _unless_big and _unless_little functions. KISS. They were confusing, and less confusing names were never found. 2014-12-09 20:43:47 -05:00
Beman
55a65c3806 Revert to again supply the reverse_endianness_in_place template. This has the effect of providing a default reverse_endianness_in_place for user-defined types. Add error checking for UDT's to verify this works as desired. Provide a note in the conversion docs to that effect. 2014-12-09 11:36:42 -05:00
Beman
a0b5805b73 Minor namespace detail cleanup. 2014-12-09 07:38:04 -05:00
Beman
f0532a3854 Improve comments. 2014-12-09 07:08:41 -05:00
Beman
db16b51b41 Tweak comments. 2014-12-05 09:05:05 -05:00
Beman
e2045b7ffa Finalize buffer and arithmetic decomposition. Finalize name changes. Finalize test cases. Remove cruft. Docs still to do. 2014-11-26 10:04:33 -05:00
Beman
56103a7bc6 Finish conversion.hpp cleanup after name changes. conversion_test.cpp return-by-value tests reorganized and passing. UTD and in-place tests still to come. Add doc/bikeshed.txt to keep record of naming rationale. 2014-11-24 10:04:23 -05:00
Beman
4197f996ac More conversion.hpp fixes. Some, but not all, conversion_test tests passing. 2014-11-23 10:38:21 -05:00
Beman
ce73f59741 Add "_endianness" to the names of the two customization points. These names must be defined in user namespaces (for ADL to work) and so must be much more explicit than names that are defined in namespace endian. 2014-11-23 08:40:58 -05:00
Beman
f9c562b4b4 Rework conversion.hpp: Make the UDT customization point for the value returning conversion functions much more explicit. Provide a separate UDT customization point for the in-place conversion functions, and reverse_in_place() overloads for the built-in arithmetic types. Eliminate the unsafe general-use reverse functions. With explicit customization points these are no longer needed. Complete the renaming of conversion functions started in the prior commit. The reverse and reverse_in_place names are much more meaningful and less likely to be misunderstood. The longer "reverse_in_place" name will hopefully at least slow users down before inappropriate (and possibly unsafe use, such as when trying to recover data after an exception). 2014-11-22 16:27:11 -05:00
Beman
49a91c293a Rename endian_buffer typedefs. New names a bit longer, but also a bit more explicit and more obviously related to endian_arithmetic typedefs. 2014-11-21 15:49:28 -05:00
Beman
84faaa7bbf Rename the conversion functions to discourage unthinking use of the in-place versions as these are unsafe in that they effectively break the type system by treating the buffer as an undescriminated union. Remove the synonym functions based on names popularized by BSD, OS X, and Linux since these are permitted to be implemented as macros, which would cause endless difficulties if encountered. 2014-11-20 15:38:25 -05:00
Beman
fc7733ade1 Major renaming. Class "endian" becomes class "endian_arithmetic" to mimic the C++ standard's description of such types as "arithmetic types". Rename header accordingly. The convenience typedefs have been changed shorten aligned names, as they are often being, but keeping the unaligned type names relatively short via a simple "_ut" suffix. 2014-11-19 10:53:11 -05:00
Beman
61d9046348 Remove "operator value_type() const noexcept" from buffers. Make the buffer ctor explicit. Buffers were requested by people who do not want automatic conversions because they want full control over conversions, and are very concerned about "efficiency".
Add "operator value_type() const noexcept" to the endian arithmetic types. These types are used by people who do want fully automatic conversions. The arithmetic types need to be drop-in replacements for the built-in arithmetic types for these users.
2014-11-18 14:33:31 -05:00
Beman
e9f6d2c37c Re-implement the endian types by inheriting from endian_buffer. 2014-11-15 21:04:19 -05:00
Beman
561d8f7070 Initial commit buffers.hpp and related infrastructure. A separate buffer class without arithmetic operators was requested during the formal review. 2014-11-15 08:02:08 -05:00
Beman
c755a6b6af Add overall css style sheet for more uniform presentation and ease of maintenance. 2014-11-12 08:26:01 -05:00
Beman
c41521cead For the endian types, add stream inserters and extractors as requested during the formal review. 2014-11-11 21:08:08 -05:00
Beman
4c58fc2efa Clear [-Wunused-parameter] warnings (Roger Leigh) 2014-08-29 08:12:16 -04:00
Beman
f1dc05db63 Replaced deprecated macro with BOOST_NO_CXX11_DEFAULTED_FUNCTIONS 2014-08-15 13:10:58 -04:00
Beman
17ca240b10 Use boost/predef/detail/endian_compat.h to determine endianness. 2014-08-15 10:59:49 -04:00
Beman
f489fad5e0 Also add aligned float types. Add docs. No tests yet. 2014-08-13 13:44:28 -04:00
Beman
8ea7d201f9 native_float32_t and native_float64_t, fixing issue #2. 2014-08-13 13:23:11 -04:00
Beman
071099b656 Remove commented out code residue from treating native as a synonym for big or little. 2014-08-12 08:29:24 -04:00
Beman
d31caa413c Add types native synonyms. All tests now passing, at least on a little endian machine. 2014-08-11 17:17:50 -04:00
Beman
8e5cd7dfc4 Treat "native" as synonym for "big" or "little" according to platform endianness, as suggested by Vicente J Botet. Converter_test working. 2014-08-11 16:21:04 -04:00
Beman
8c36890e77 Test and doc updates for Pierre Talbot's int8_t/uint8_t reverse_value() and templated reverse() patch. 2014-04-16 13:52:24 -04:00
Pierre Talbot
11fc1ea374 Add overloads for int8_t and uint8_t (rational: useful with generic programming). Template the reverse function (same body in each overloads). 2014-01-22 18:09:50 +01:00
Beman
d339470e6e Remove "explicit" from Endian type constructors. Rationale: Having to write "cntr.insert(big_int32_t(value))" instead of "cntr.insert(value)" gets old fast when you are writing application code and the use case arises more or less continuously. Additionally, the use of an endian type is an implementation detail that should not leak into the application code that needs to create values of the type. Furthermore, the ambiguities that caused the constructors to be made explicit no longer occur; they were eliminated when BOOST_MINIMAL_INTEGER_COVER_OPERATORS was introduced to removed a dependency on boost/operators.hpp. If an ambiguity does arise, it is easy to clear via a static_cast or a function-style cast. 2013-09-06 10:36:54 -04:00
Beman
016d3b2e7c Rename the endian typedefs. Rationale: Subjective - during three months working on the B-tree library, the *un_t names were a constant source of irritation. Objective - the new scheme, which reverts the *un_t names to having no alignment decoration, provides consistent *_align* decoration for both FP and integer types. Also, the library now provides conversion functions which may reduce use of aligned endian types. 2013-09-01 08:40:32 -04:00
Beman
d1d62f3adc Use detail::reverse_value() to implement reverse_value() for float and double, thus eliminating type-punning warning from gcc. 2013-06-07 15:46:14 -04:00
Beman
db3864b3d4 Fix boo boos detected by inspect program. 2013-05-29 09:40:35 -04:00
Beman
fbedc9bb9f Remove another bin_manip file. Note that all the bin-manip files have been copied to git@github.com:Beman/bin-manip.git 2013-05-29 08:36:40 -04:00
Beman
50b5488997 loop_time_test current work-in-progress 2013-05-27 08:53:18 -04:00
Beman
7f9d91e6d2 Rename unaligned integers to fit the floating point pattern. Unifies the naming pattern, deliberately makes the unaligned type names a bit uglier. 2013-05-26 12:05:33 -04:00
Beman
dff7c1254e Add unaligned floating point types and supporting infrastructure. 2013-05-26 08:25:10 -04:00
Beman
a7ba65f830 Implement, test, float and double endian types. 2013-05-25 12:16:32 -04:00
Beman
41f0c15844 Initial done_list.html. Improve general FAQ. Update example. Add BOOST_NOEXCEPT to types.hpp and cover_operators.hpp. 2013-05-22 13:26:51 -04:00
Beman
6f84684e9e Add separate big and little specializations for aligned case; the attempt to combine into a single specialization was selecting the unaligned specialization. Rework speed_test to try to get more meaningful results and cover more test cases. 2013-05-22 08:14:51 -04:00
Beman
a855a35c57 align::yes specialization working, using ::boost::endian::convert_value<...>(T). 2013-05-21 17:31:08 -04:00
Beman
50e389f63c Preliminary work on align::yes specialization. 2013-05-21 17:03:07 -04:00
Beman
4d6f7001fa Create separate synopsis section 2013-05-21 08:38:24 -04:00
Beman
ddb5936b68 Yet another naming scheme for type synonyms. Aligned type names now exactly follow the <cstdint> pattern, while the unaligned names elide "int". 2013-05-21 07:56:27 -04:00
Beman
870b542456 Rename endian types to a scheme that mimics cstdint.hpp. Change test and example code accordingly. 2013-05-20 17:03:12 -04:00
Beman
f13a9cd6a4 Rename integers.hpp to types.hpp in case floating point is someday supported. 2013-05-20 09:07:01 -04:00
Beman
6130c5f84c Continue refinement of specs. Add to FAQ. Create function group bookmarks and link to them. 2013-05-19 17:08:42 -04:00
Beman
1fc19c5a27 Rename actual_order to effective_order. We don't know the actual order. Simplify an expression. 2013-05-19 07:15:09 -04:00
Beman
9089eb037b Rename header converters.hpp back to conversion.hpp. Clean up infrastructure. 2013-05-18 16:14:30 -04:00
Beman
90eea0566c Fix misplaced namespace endian 2013-05-18 08:27:37 -04:00
Beman
4a2ccdcfc8 Fix failure to define BOOST_ENDIAN_INTRINSIC_MSG when user defines BOOST_ENDIAN_NO_INTRINSICS 2013-05-16 17:48:47 -04:00
Beman
9a1d520572 Use a more robust detection of __builtin_bswap funtions for Clang. Fix Clang lack of __builtin_bswap16 in some releases. To be conservative only, fallback to byteswap.h if __linux__ is defined. Fix intrinsic_test so that <cstdint> isn't required. 2013-05-16 17:22:38 -04:00
Beman
4066443d89 Rework intrinsic.hpp to handle GCC and Clang __builtin_bswap* if available. Add test program. 2013-05-16 10:40:18 -04:00
Beman
88268249a9 Remove inclusion of unreferenced headers. Add comment about Microsoft/Visual Studio availability of intrinsics. 2013-05-15 15:38:34 -04:00
Beman
8b4bd2adfc Add synonyms based on names popularized by BSD, e.g. OS X, Linux. 2013-05-15 08:51:05 -04:00
Beman
09b361e161 Simulated function template partial specialization working. converter_test and pair_test passing. 2013-05-14 17:59:50 -04:00
Beman
1a496f277e Signs of life 2013-05-14 09:59:18 -04:00
Beman
c407260b51 Initial commit 2013-05-13 16:00:56 -04:00
Beman
6cf5464cd2 Distinguish between ReversibleValue and Reversible in both name and behavior. 2013-05-13 14:16:54 -04:00
Beman
2f6dba3ab6 Fixes for older gcc. Fixes for big endian machines. 2013-05-13 10:09:25 -04:00
Beman
4c0bd87c18 Tweaks to get tests running with various compilers. 2013-05-12 17:42:48 -04:00
Beman
a7475d0f63 Really fix the bug this time. Add TODO list. 2013-05-12 14:28:20 -04:00
Beman
ccc71a9ec8 Change T to Reversible to indicate requirement on template parameters. Fix bug in big_endian. 2013-05-12 11:45:04 -04:00
Beman
6c00b65eb4 Add light test of modify-in-place interface 2013-05-12 11:31:32 -04:00
Beman
89d13e9d02 Add modify in place interface, implementation. No tests yet. 2013-05-12 10:16:35 -04:00
Beman
0fef88ab3f Change names to make room for modify-in-place names. 2013-05-12 08:58:44 -04:00
Beman
854c27939a Change name of conditional conversion functions to big_endian and little_endian. 2013-05-12 07:52:42 -04:00
Beman
50c1a27386 Change name convert_bytes to convert. Given the namespace, template parameters, and function arguments, it is obvious what is being converted, and "bytes" is too low level for this function. 2013-05-12 07:25:12 -04:00
Beman
2794810b29 converter_test.cpp refactoring complete 2013-05-11 17:41:06 -04:00
Beman
97b024bcf6 Continue refactoring converter_test.cpp. 2013-05-11 17:18:17 -04:00
Beman
c349e35e91 Enable double, fix bug in generic reverse_bytes implementation. Begin refactoring converter_test code. 2013-05-11 16:08:15 -04:00
Beman
9e96faf4c1 float showing signs of life. 2013-05-11 08:13:55 -04:00
Beman
6af16cc339 compile-time convert_bytes working, all signed and unsigned integer cases being tested. 2013-05-10 17:51:58 -04:00
Beman
553d6a2426 Work in progress. Detect wrong endianness reported by boost/detail/endian.hpp. Add intrinsic timing to benchmark.cpp. Add boost/endian/detail/intrinsic.hpp. Use intrinsics in converters when available. Begin adding convert_bytes tests to converter_test.cpp. 2013-05-10 16:51:24 -04:00
Beman
fcb5386537 All tests passing, all VC++ projects consistent 2013-05-10 11:26:17 -04:00
Beman
6f496a40cd Unstable work-in-progress. Define order enum in either header. Add runtime function implementations. 2013-05-10 08:56:14 -04:00
Beman
cd9117941f Unstable work in progress.
Change names to reverse_bytes and convert_bytes.
Add runtime convert_bytes function.
compile-time generic byte order conversion.
2013-05-10 07:36:21 -04:00