diff options
Diffstat (limited to 'pw_bytes/docs.rst')
-rw-r--r-- | pw_bytes/docs.rst | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/pw_bytes/docs.rst b/pw_bytes/docs.rst index c2868b470..6313abb89 100644 --- a/pw_bytes/docs.rst +++ b/pw_bytes/docs.rst @@ -45,8 +45,8 @@ Functions for converting the endianness of integral values. pw_bytes/units.h ---------------- -Constants and helper user-defined literals for specifying a number of bytes in -powers of two, as defined by IEC 60027-2 A.2 and ISO/IEC 80000:13-2008. +Constants, functions and user-defined literals for specifying a number of bytes +in powers of two, as defined by IEC 60027-2 A.2 and ISO/IEC 80000:13-2008. The supported suffixes include: * ``_B`` for bytes (1024^0) @@ -67,6 +67,17 @@ In order to use these you must use a using namespace directive, for example: constexpr size_t kRandomBufferSizeBytes = 1_MiB + 42_KiB; +In some cases, the use of user-defined literals is not permitted because of the +required using namespace directive. One example of this is in header files, +where it is undesirable to pollute the namespace. For this situation, there are +also similar functions: + +.. code-block:: cpp + + #include "pw_bytes/units.h" + + constexpr size_t kBufferSizeBytes = pw::bytes::MiB(1) + pw::bytes::KiB(42); + Zephyr ====== To enable ``pw_bytes`` for Zephyr add ``CONFIG_PIGWEED_BYTES=y`` to the |