--- libecb/ecb.pod 2020/01/20 20:58:51 1.80 +++ libecb/ecb.pod 2020/04/30 23:24:45 1.86 @@ -12,14 +12,14 @@ http://software.schmorp.de/pkg/libecb -It mainly provides a number of wrappers around GCC built-ins, together -with replacement functions for other compilers. In addition to this, -it provides a number of other lowlevel C utilities, such as endianness -detection, byte swapping or bit rotations. - -Or in other words, things that should be built into any standard C system, -but aren't, implemented as efficient as possible with GCC, and still -correct with other compilers. +It mainly provides a number of wrappers around many compiler built-ins, +together with replacement functions for other compilers. In addition +to this, it provides a number of other lowlevel C utilities, such as +endianness detection, byte swapping or bit rotations. + +Or in other words, things that should be built into any standard C +system, but aren't, implemented as efficient as possible with GCC (clang, +msvc...), and still correct with other compilers. More might come. @@ -87,7 +87,7 @@ =item ECB_C True if the implementation defines the C<__STDC__> macro to a true value, -while not claiming to be C++. +while not claiming to be C++, i..e C, but not C++. =item ECB_C99 @@ -112,11 +112,19 @@ True if the implementation claims to be compliant to C++11/C++14/C++17 (ISO/IEC 14882:2011, :2014, :2017) or any later version. +Note that many C++20 features will likely have their own feature test +macros (see e.g. L). + +=item ECB_OPTIMIZE_SIZE + +Is C<1> when the compiler optimizes for size, C<0> otherwise. This symbol +can also be defined before including F, in which case it will be +unchanged. + =item ECB_GCC_VERSION (major, minor) -Expands to a true value (suitable for testing in by the preprocessor) -if the compiler used is GNU C and the version is the given version, or -higher. +Expands to a true value (suitable for testing by the preprocessor) if the +compiler used is GNU C and the version is the given version, or higher. This macro tries to return false on compilers that claim to be GCC compatible but aren't. @@ -145,7 +153,7 @@ =item ECB_STDFP -If this evaluates to a true value (suitable for testing in by the +If this evaluates to a true value (suitable for testing by the preprocessor), then C and C use IEEE 754 single/binary32 and double/binary64 representations internally I the endianness of both types match the endianness of C and C. @@ -229,8 +237,8 @@ =item ecb_unused Marks a function or a variable as "unused", which simply suppresses a -warning by GCC when it detects it as unused. This is useful when you e.g. -declare a variable but do not always use it: +warning by the compiler when it detects it as unused. This is useful when +you e.g. declare a variable but do not always use it: { ecb_unused int var; @@ -410,12 +418,6 @@ =over 4 -=item ECB_OPTIMIZE_SIZE - -Is C<1> when the compiler optimizes for size, C<0> otherwise. This symbol -can also be defined before including F, in which case it will be -unchanged. - =item bool ecb_is_constant (expr) Returns true iff the expression can be deduced to be a compile-time @@ -725,9 +727,9 @@ all the bits by C positions to the right (C) or left (C). -Current GCC versions understand these functions and usually compile them -to "optimal" code (e.g. a single C or a combination of C on -x86). +Current GCC/clang versions understand these functions and usually compile +them to "optimal" code (e.g. a single C or a combination of C +on x86). =item T ecb_rotl (T x, unsigned int count) [C++] @@ -789,6 +791,8 @@ =item T ecb_host_to_le (T v) +=back + These functions work like their C counterparts, above, but use templates, which make them useful in generic code. @@ -1013,8 +1017,8 @@ type (this typically excludes the minimum signed integer value, the same limitation as for C and C<%> in C). -Current GCC versions compile this into an efficient branchless sequence on -almost all CPUs. +Current GCC/clang versions compile this into an efficient branchless +sequence on almost all CPUs. For example, when you want to rotate forward through the members of an array for increasing C (which might be negative), then you should use