summaryrefslogtreecommitdiff
path: root/src/mongo/platform/endian_test.cpp
AgeCommit message (Collapse)Author
2023-07-01SERVER-77049 SERVER-77050 IWYU automated changes up to 1.0Daniel Moody
2019-10-02SERVER-43175 platform/endian.h refreshBilly Donahue
This is a very low-level bare metal header, and should ideally #include only std headers. - Remove Decimal128 dependency from endian.h. Decimal128 doesn't need endian conversions, and makes endian.h transitively include several higher-level mongo specifics. Current conversions are underspecified and mathematically incorrect or at least ambiguous. They swap the order within each of the low64 and high64 fields, but don't swap them with each other. This is behavior needed only by one spot in db/pipeline/value.cpp to deserialize NumberDecimal, so we can just inline the behavior there and remove it from endian.h. - Remove MONGO_CONFIG_BYTE_ORDER from config.h. The running compiler holds the ultimate truth on what the target endianness is (available via _BYTE_ORDER_). We should not read it from a config header. The names exported into C++ code for the endian possibilities can be changed to line up with those in C++20's std::endian {big,little,native} enum. This eliminates the Scons<=>C++ bridge protocol of "1234" and "4321" magic numbers. Scons will talk to the compiler, not directly to the code. - Use enum expressions (including if constexpr) rather than #if for branching on endianness. This makes bit-rot of unexecuted paths less likely, and is just cleaner C++. - Remove bswap_slow variants. All supported compilers have builtin bswap operations. Can reduce to a simple MSVC vs GCC branching. All compilers have a builtin, so remove the bswap_slow" implementation. - Don't need all the push_macro / pop_macro stuff, or really any macros at all. Just rely on inline C++ functions. These optimize to the same thing. - Don't need ByteOrderConverter or IntegralTypeMap traits either. Simpler metaprogramming based only on sizeof will work fine. All in all we can remove about 400 lines of old code here and shave some low-level edges off of the dependency graph. - benchmark
2019-02-13SERVER-39560 - remove leading blank line on all C++ filesBilly Donahue
Remove leading comments that are just stating the filename. Move any file-level comments below the copyright banner. Remove leading blank lines.
2018-10-22SERVER-37651 Update header files with new licenseRamon Fernandez
2015-06-20SERVER-18579: Clang-Format - reformat code, no comment reflowMark Benvenuto
2015-04-03SERVER-17863 Sort in config.h header when possibleAndrew Morrow
2015-03-26SERVER-9563 Add support for config.h headerJonathan Reams
2014-09-08SERVER-15174 Provide some improved semantics for data_cursor and data_viewAndrew Morrow
2014-08-12SERVER-14852 AAE safe read/write primitivesJason Carey
Alignment, aliasing and endian safe read write primitives in the form of DataView and DataCursor primitives. These primitives provide safe reads and writes with explicit endian variants that funnel through std::memcpy to provide defined behavior. Support for a safe packed struct idiom is also provided in the encoded_value_storage class.