Initial import of nlio
From https://github.com/nestlabs/nlio
At revision 9f9f503b77d7d061ec5a50613b880e9c5bc7ad30
diff --git a/CHANGES b/CHANGES
new file mode 100644
index 0000000..e2a6266
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,34 @@
+1.1.6 (2019-05-24)
+
+ * Updated to nlbuild-autotools 1.6.11.
+
+1.1.5 (2019-04-30)
+
+ * Updated to nlbuild-autotools 1.6.9.
+
+1.1.4 (2019-04-09)
+
+ * Updated to nlbuild-autotools 1.6.6.
+
+ * Addressed a documentation typo.
+
+1.1.3 (2018-11-19)
+
+ * Updated to nlbuild-autotools 1.6.5.
+
+1.1.2 (2018-11-15)
+
+ * Updated to nlbuild-autotools 1.6.4.
+
+1.1.1 (2018-04-26)
+
+ * Updated to nlbuild-autotools 1.5.2.
+
+1.1 (2018-04-19)
+
+ * Updated to utilize nlbuild-autotools 1.5.0, removing inlined
+ copy of nlunit-test in the process.
+
+1.0 (2017-06-29)
+
+ * First public release to Github.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..2827b7d
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,27 @@
+Want to contribute? Great! First, read this page (including the small print at the end).
+
+### Before you contribute
+Before we can use your code, you must sign the
+[Google Individual Contributor License Agreement]
+(https://cla.developers.google.com/about/google-individual)
+(CLA), which you can do online. The CLA is necessary mainly because you own the
+copyright to your changes, even after your contribution becomes part of our
+codebase, so we need your permission to use and distribute your code. We also
+need to be sure of various other things—for instance that you'll tell us if you
+know that your code infringes on other people's patents. You don't have to sign
+the CLA until after you've submitted your code for review and a member has
+approved it, but you must do it before we can put your code into our codebase.
+Before you start working on a larger contribution, you should get in touch with
+us first through the issue tracker with your idea so that we can help out and
+possibly guide you. Coordinating up front makes it much easier to avoid
+frustration later on.
+
+### Code reviews
+All submissions, including submissions by project members, require review. We
+use Github pull requests for this purpose.
+
+### The small print
+Contributions made by corporations are covered by a different agreement than
+the one above, the
+[Software Grant and Corporate Contributor License Agreement]
+(https://cla.developers.google.com/about/google-corporate).
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..cddf2a0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,45 @@
+[![Build Status][nlio-travis-svg]][nlio-travis]
+[![Coverage Status][nlio-codecov-svg]][nlio-codecov]
+
+Nest Labs Memory Mapped I/O
+===========================
+
+# Introduction
+
+Nest Labs Memory Mapped I/O (NLIO) is designed to provide both C
+and C++ language bindings to macros and functions for:
+
+1. Determining, at both compile- and run-time, the byte ordering
+ of the target system.
+2. Performing in place byte-swapping of compile-time constants
+ via the C preprocessor as well as functions for performing
+ byte-swapping by value and in place by pointer for 16-, 32-, and
+ 64-bit types.
+3. Safely performing simple, efficient memory-mapped accesses,
+ potentially to unaligned memory locations, with or without byte
+ reordering, to 8-, 16-, 32-, and 64-bit quantities. Functions
+ both with and without pointer management are also available.
+
+[nlio-travis]: https://travis-ci.org/nestlabs/nlio
+[nlio-travis-svg]: https://travis-ci.org/nestlabs/nlio.svg?branch=master
+[nlio-codecov]: https://codecov.io/gh/nestlabs/nlio
+[nlio-codecov-svg]: https://codecov.io/gh/nestlabs/nlio/branch/master/graph/badge.svg
+
+# Interact
+
+There are numerous avenues for nlio support:
+
+ * Bugs and feature requests — [submit to the Issue Tracker](https://github.com/nestlabs/nlio/issues)
+ * Google Groups — discussion and announcements
+ * [nlio-announce](https://groups.google.com/forum/#!forum/nlio-announce) — release notes and new updates on nlio
+ * [nlio-users](https://groups.google.com/forum/#!forum/nlio-users) — discuss use of and enhancements to nlio
+
+# Versioning
+
+nlio follows the [Semantic Versioning guidelines](http://semver.org/)
+for release cycle transparency and to maintain backwards compatibility.
+
+# License
+
+nlio is released under the [Apache License, Version 2.0 license](https://opensource.org/licenses/Apache-2.0).
+See the `LICENSE` file for more information.
diff --git a/include/nlbyteorder-big.h b/include/nlbyteorder-big.h
new file mode 100644
index 0000000..959604b
--- /dev/null
+++ b/include/nlbyteorder-big.h
@@ -0,0 +1,246 @@
+/**
+ * Copyright 2012-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines defines functions for performing by value
+ * byte reordering for 16-, 32-, and 64-bit quantities both
+ * to-and-from the target system (i.e. host) byte ordering
+ * to-and-from both little and big endian byte ordering,
+ * specifically for big endian target systems.
+ */
+
+#ifndef NLBYTEORDER_BIG_H
+#define NLBYTEORDER_BIG_H
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in little endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint16_t nlByteOrderSwap16LittleToHost(uint16_t inValue)
+{
+ return nlByteOrderSwap16(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in little endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint32_t nlByteOrderSwap32LittleToHost(uint32_t inValue)
+{
+ return nlByteOrderValueSwap32(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in little endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint64_t nlByteOrderSwap64LittleToHost(uint64_t inValue)
+{
+ return nlByteOrderValueSwap64(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to little endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint16_t nlByteOrderSwap16HostToLittle(uint16_t inValue)
+{
+ return nlByteOrderValueSwap16(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to little endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint32_t nlByteOrderSwap32HostToLittle(uint32_t inValue)
+{
+ return nlByteOrderValueSwap32(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to little endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint64_t nlByteOrderSwap64HostToLittle(uint64_t inValue)
+{
+ return nlByteOrderValueSwap64(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in big endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint16_t nlByteOrderSwap16BigToHost(uint16_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in big endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint32_t nlByteOrderSwap32BigToHost(uint32_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in big endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint64_t nlByteOrderSwap64BigToHost(uint64_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to big endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint16_t nlByteOrderSwap16HostToBig(uint16_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to big endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint32_t nlByteOrderSwap32HostToBig(uint32_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to big endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint64_t nlByteOrderSwap64HostToBig(uint64_t inValue)
+{
+ return inValue;
+}
+
+#endif /* NLBYTEORDER_BIG_H */
+
diff --git a/include/nlbyteorder-little.h b/include/nlbyteorder-little.h
new file mode 100644
index 0000000..72236ba
--- /dev/null
+++ b/include/nlbyteorder-little.h
@@ -0,0 +1,246 @@
+/**
+ * Copyright 2012-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines defines functions for performing by value
+ * byte reordering for 16-, 32-, and 64-bit quantities both
+ * to-and-from the target system (i.e. host) byte ordering
+ * to-and-from both little and big endian byte ordering,
+ * specifically for little endian target systems.
+ */
+
+#ifndef NLBYTEORDER_LITTLE_H
+#define NLBYTEORDER_LITTLE_H
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in little endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint16_t nlByteOrderSwap16LittleToHost(uint16_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in little endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint32_t nlByteOrderSwap32LittleToHost(uint32_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in little endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint64_t nlByteOrderSwap64LittleToHost(uint64_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to little endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint16_t nlByteOrderSwap16HostToLittle(uint16_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to little endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint32_t nlByteOrderSwap32HostToLittle(uint32_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to little endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint64_t nlByteOrderSwap64HostToLittle(uint64_t inValue)
+{
+ return inValue;
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in big endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint16_t nlByteOrderSwap16BigToHost(uint16_t inValue)
+{
+ return nlByteOrderValueSwap16(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in big endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint32_t nlByteOrderSwap32BigToHost(uint32_t inValue)
+{
+ return nlByteOrderValueSwap32(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in big endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint64_t nlByteOrderSwap64BigToHost(uint64_t inValue)
+{
+ return nlByteOrderValueSwap64(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to big endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint16_t nlByteOrderSwap16HostToBig(uint16_t inValue)
+{
+ return nlByteOrderValueSwap16(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to big endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint32_t nlByteOrderSwap32HostToBig(uint32_t inValue)
+{
+ return nlByteOrderValueSwap32(inValue);
+}
+
+/**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to big endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint64_t nlByteOrderSwap64HostToBig(uint64_t inValue)
+{
+ return nlByteOrderValueSwap64(inValue);
+}
+
+#endif /* NLBYTEORDER_LITTLE_H */
+
diff --git a/include/nlbyteorder.h b/include/nlbyteorder.h
new file mode 100644
index 0000000..b56ffe6
--- /dev/null
+++ b/include/nlbyteorder.h
@@ -0,0 +1,322 @@
+/**
+ * Copyright 2012-2017 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines macros for performing in place byte-
+ * swapping of compile-time constants via the C preprocessor as
+ * well as functions for performing byte-swapping by value and in
+ * place by pointer for 16-, 32-, and 64-bit types.
+ */
+
+#ifndef NLBYTEORDER_H
+#define NLBYTEORDER_H
+
+#include <nlio-private.h>
+
+#include <stdint.h>
+
+/*
+ * If we are compiling under clang, GCC, or any such compatible
+ * compiler, in which -fno-builtins or -ffreestanding might be
+ * asserted, thereby eliminating built-in function optimization, we
+ * STILL want to leverage built-in bswap{16,32,64}, if available. We
+ * want this because it allows the compiler to use
+ * architecture-specific machine instructions or inline code
+ * generation to optimize an otherwise-generic and non-optimized code
+ * for byte reordering, which is exactly the kind of efficiency that
+ * would be expected of nlByteOrder.
+ */
+
+#if __nlIOHasBuiltin(__builtin_bswap16)
+#define __nlBYTEORDER_BSWAP16 __builtin_bswap16
+#else
+#define __nlBYTEORDER_BSWAP16 nlByteOrderConstantSwap16
+#endif
+
+#if __nlIOHasBuiltin(__builtin_bswap32)
+#define __nlBYTEORDER_BSWAP32 __builtin_bswap32
+#else
+#define __nlBYTEORDER_BSWAP32 nlByteOrderConstantSwap32
+#endif
+
+#if __nlIOHasBuiltin(__builtin_bswap64)
+#define __nlBYTEORDER_BSWAP64 __builtin_bswap64
+#else
+#define __nlBYTEORDER_BSWAP64 nlByteOrderConstantSwap64
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @def nlByteOrderConstantSwap16
+ *
+ * @brief
+ * Performs a preprocessor-compatible in place byte swap of the
+ * provided 16-bit value.
+ *
+ */
+#define nlByteOrderConstantSwap16(c) \
+ ((uint16_t) \
+ ((((uint16_t)(c) & (uint16_t)0x00ffU) << 8) | \
+ (((uint16_t)(c) & (uint16_t)0xff00U) >> 8)))
+
+/**
+ * @def nlByteOrderConstantSwap32
+ *
+ * @brief
+ * Performs a preprocessor-compatible in place byte swap of the
+ * provided 32-bit value.
+ *
+ */
+#define nlByteOrderConstantSwap32(c) \
+ ((uint32_t) \
+ ((((uint32_t)(c) & (uint32_t)0x000000ffUL) << 24) | \
+ (((uint32_t)(c) & (uint32_t)0x0000ff00UL) << 8) | \
+ (((uint32_t)(c) & (uint32_t)0x00ff0000UL) >> 8) | \
+ (((uint32_t)(c) & (uint32_t)0xff000000UL) >> 24)))
+
+/**
+ * @def nlByteOrderConstantSwap64
+ *
+ * @brief
+ * Performs a preprocessor-compatible in place byte swap of the
+ * provided 64-bit value.
+ *
+ */
+#define nlByteOrderConstantSwap64(c) \
+ ((uint64_t) \
+ ((((uint64_t)(c) & (uint64_t)0x00000000000000ffULL) << 56) | \
+ (((uint64_t)(c) & (uint64_t)0x000000000000ff00ULL) << 40) | \
+ (((uint64_t)(c) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
+ (((uint64_t)(c) & (uint64_t)0x00000000ff000000ULL) << 8) | \
+ (((uint64_t)(c) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
+ (((uint64_t)(c) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
+ (((uint64_t)(c) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
+ (((uint64_t)(c) & (uint64_t)0xff00000000000000ULL) >> 56)))
+
+/**
+ * @def NLBYTEORDER_LITTLE_ENDIAN
+ *
+ * @brief
+ * Constant preprocessor definition used to test #NLBYTEORDER
+ * against to determine whether the target system uses little
+ * endian byte ordering.
+ *
+ * @code
+ * #if NLBYTEORDER == NLBYTEORDER_LITTLE_ENDIAN
+ *
+ * Do something that is little endian byte ordering-specific.
+ *
+ * #endif
+ * @endcode
+ *
+ */
+#define NLBYTEORDER_LITTLE_ENDIAN 0x1234
+
+/**
+ * @def NLBYTEORDER_BIG_ENDIAN
+ *
+ * @brief
+ * Constant preprocessor definition used to test #NLBYTEORDER
+ * against to determine whether the target system uses big
+ * endian byte ordering.
+ *
+ * @code
+ * #if NLBYTEORDER == NLBYTEORDER_BIG_ENDIAN
+ *
+ * Do something that is little endian byte ordering-specific.
+ *
+ * #endif
+ * @endcode
+ *
+ */
+#define NLBYTEORDER_BIG_ENDIAN 0x4321
+
+/**
+ * @def NLBYTEORDER_UNKNOWN_ENDIAN
+ *
+ * @brief
+ * Constant preprocessor definition used to test #NLBYTEORDER
+ * against to determine whether the target system uses unknown
+ * byte ordering.
+ *
+ * @code
+ * #elif NLBYTEORDER == NLBYTEORDER_UNKNOWN_ENDIAN
+ * #error "Unknown byte ordering!"
+ * #endif
+ * @endcode
+ *
+ */
+#define NLBYTEORDER_UNKNOWN_ENDIAN 0xFFFF
+
+/**
+ * @def NLBYTEORDER
+ *
+ * @brief
+ * Constant preprocessor definition containing the target system
+ * byte ordering. May be one of:
+ *
+ * - NLBYTEORDER_BIG_ENDIAN
+ * - NLBYTEORDER_LITTLE_ENDIAN
+ * - NLBYTEORDER_UNKNOWN_ENDIAN
+ *
+ */
+#if defined(__LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+#define NLBYTEORDER NLBYTEORDER_LITTLE_ENDIAN
+#elif defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__) || (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+#define NLBYTEORDER NLBYTEORDER_BIG_ENDIAN
+#else
+#error "Endianness undefined!"
+#define NLBYTEORDER NLBYTEORDER_UNKNOWN_ENDIAN
+#endif /* defined(__LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) */
+
+enum {
+ nlByteOrderUnknown = NLBYTEORDER_UNKNOWN_ENDIAN,
+ nlByteOrderLittleEndian = NLBYTEORDER_LITTLE_ENDIAN,
+ nlByteOrderBigEndian = NLBYTEORDER_BIG_ENDIAN
+};
+
+/**
+ * This represents a type for a byte ordering.
+ */
+typedef uint16_t nlByteOrder;
+
+/**
+ * This returns the byte order of the current system.
+ *
+ * @return The byte order of the current system.
+ */
+static inline nlByteOrder nlByteOrderGetCurrent(void)
+{
+#if (NLBYTEORDER == NLBYTEORDER_LITTLE_ENDIAN)
+ return nlByteOrderLittleEndian;
+#elif (NLBYTEORDER == NLBYTEORDER_BIG_ENDIAN)
+ return nlByteOrderBigEndian;
+#else
+ return nlByteOrderUnknown;
+#endif
+}
+
+/**
+ * This unconditionally performs a byte order swap by value of the
+ * specified 16-bit value.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint16_t nlByteOrderValueSwap16(uint16_t inValue)
+{
+ return __nlBYTEORDER_BSWAP16(inValue);
+}
+
+/**
+ * This unconditionally performs a byte order swap by value of the
+ * specified 32-bit value.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint32_t nlByteOrderValueSwap32(uint32_t inValue)
+{
+ return __nlBYTEORDER_BSWAP32(inValue);
+}
+
+/**
+ * This unconditionally performs a byte order swap by value of the
+ * specified 64-bit value.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+static inline uint64_t nlByteOrderValueSwap64(uint64_t inValue)
+{
+ return __nlBYTEORDER_BSWAP64(inValue);
+}
+
+/**
+ * This unconditionally performs a byte order swap by pointer in place
+ * of the specified 16-bit value.
+ *
+ * @warning The input value is assumed to be on a natural alignment
+ * boundary for the target system. It is the responsibility of the
+ * caller to perform any necessary alignment to avoid system faults
+ * for systems that do not support unaligned accesses.
+ *
+ * @param[inout] inValue A pointer to the 16-bit value to be byte
+ * order swapped.
+ */
+static inline void nlByteOrderPointerSwap16(uint16_t *inValue)
+{
+ *inValue = nlByteOrderValueSwap16(*inValue);
+}
+
+/**
+ * This unconditionally performs a byte order swap by pointer in place
+ * of the specified 32-bit value.
+ *
+ * @warning The input value is assumed to be on a natural alignment
+ * boundary for the target system. It is the responsibility of the
+ * caller to perform any necessary alignment to avoid system faults
+ * for systems that do not support unaligned accesses.
+ *
+ * @param[inout] inValue A pointer to the 32-bit value to be byte
+ * order swapped.
+ */
+static inline void nlByteOrderPointerSwap32(uint32_t *inValue)
+{
+ *inValue = nlByteOrderValueSwap32(*inValue);
+}
+
+/**
+ * This unconditionally performs a byte order swap by pointer in place
+ * of the specified 64-bit value.
+ *
+ * @warning The input value is assumed to be on a natural alignment
+ * boundary for the target system. It is the responsibility of the
+ * caller to perform any necessary alignment to avoid system faults
+ * for systems that do not support unaligned accesses.
+ *
+ * @param[inout] inValue A pointer to the 64-bit value to be byte
+ * order swapped.
+ */
+static inline void nlByteOrderPointerSwap64(uint64_t *inValue)
+{
+ *inValue = nlByteOrderValueSwap64(*inValue);
+}
+
+#if (NLBYTEORDER == NLBYTEORDER_LITTLE_ENDIAN)
+#include <nlbyteorder-little.h>
+#elif (NLBYTEORDER == NLBYTEORDER_BIG_ENDIAN)
+#include <nlbyteorder-big.h>
+#endif /* (NLBYTEORDER == NLBYTEORDER_LITTLE_ENDIAN) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#undef __nlBYTEORDER_BSWAP16
+#undef __nlBYTEORDER_BSWAP32
+#undef __nlBYTEORDER_BSWAP64
+
+#endif /* NLBYTEORDER_H */
+
+
diff --git a/include/nlbyteorder.hpp b/include/nlbyteorder.hpp
new file mode 100644
index 0000000..7735b7d
--- /dev/null
+++ b/include/nlbyteorder.hpp
@@ -0,0 +1,378 @@
+/**
+ * Copyright 2012-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines C++ functions for performing byte-swapping
+ * by value and in place by pointer for 16-, 32-, and 64-bit
+ * types.
+ *
+ */
+
+#ifndef NLBYTEORDER_HPP
+#define NLBYTEORDER_HPP
+
+#include <nlbyteorder.h>
+
+namespace nl
+{
+
+ namespace ByteOrder
+ {
+ enum {
+ Unknown = nlByteOrderUnknown,
+ LittleEndian = nlByteOrderLittleEndian,
+ BigEndian = nlByteOrderBigEndian
+ };
+
+ /**
+ * This represents a type for a byte ordering.
+ */
+ typedef nlByteOrder ByteOrder;
+
+ /**
+ * This returns the byte order of the current system.
+ *
+ * @return The byte order of the current system.
+ */
+ inline ByteOrder GetCurrent(void)
+ {
+ return nlByteOrderGetCurrent();
+ }
+
+ /**
+ * This unconditionally performs a byte order swap by value of the
+ * specified 16-bit value.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint16_t Swap16(uint16_t inValue)
+ {
+ return nlByteOrderValueSwap16(inValue);
+ }
+
+ /**
+ * This unconditionally performs a byte order swap by value of the
+ * specified 32-bit value.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint32_t Swap32(uint32_t inValue)
+ {
+ return nlByteOrderValueSwap32(inValue);
+ }
+
+ /**
+ * This unconditionally performs a byte order swap by value of the
+ * specified 64-bit value.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint64_t Swap64(uint64_t inValue)
+ {
+ return nlByteOrderValueSwap64(inValue);
+ }
+
+ /**
+ * This unconditionally performs a byte order swap by pointer in place
+ * of the specified 16-bit value.
+ *
+ * @warning The input value is assumed to be on a natural alignment
+ * boundary for the target system. It is the responsibility of the
+ * caller to perform any necessary alignment to avoid system faults
+ * for systems that do not support unaligned accesses.
+ *
+ * @param[inout] inValue A pointer to the 16-bit value to be byte
+ * order swapped.
+ */
+ inline void Swap16(uint16_t *inValue)
+ {
+ nlByteOrderPointerSwap16(inValue);
+ }
+
+ /**
+ * This unconditionally performs a byte order swap by pointer in place
+ * of the specified 32-bit value.
+ *
+ * @warning The input value is assumed to be on a natural alignment
+ * boundary for the target system. It is the responsibility of the
+ * caller to perform any necessary alignment to avoid system faults
+ * for systems that do not support unaligned accesses.
+ *
+ * @param[inout] inValue A pointer to the 32-bit value to be byte
+ * order swapped.
+ */
+ inline void Swap32(uint32_t *inValue)
+ {
+ nlByteOrderPointerSwap32(inValue);
+ }
+
+ /**
+ * This unconditionally performs a byte order swap by pointer in place
+ * of the specified 64-bit value.
+ *
+ * @warning The input value is assumed to be on a natural alignment
+ * boundary for the target system. It is the responsibility of the
+ * caller to perform any necessary alignment to avoid system faults
+ * for systems that do not support unaligned accesses.
+ *
+ * @param[inout] inValue A pointer to the 64-bit value to be byte
+ * order swapped.
+ */
+ inline void Swap64(uint64_t *inValue)
+ {
+ nlByteOrderPointerSwap64(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in little endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint16_t Swap16LittleToHost(uint16_t inValue)
+ {
+ return nlByteOrderSwap16LittleToHost(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in little endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint32_t Swap32LittleToHost(uint32_t inValue)
+ {
+ return nlByteOrderSwap32LittleToHost(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in little endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint64_t Swap64LittleToHost(uint64_t inValue)
+ {
+ return nlByteOrderSwap64LittleToHost(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to little endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint16_t Swap16HostToLittle(uint16_t inValue)
+ {
+ return nlByteOrderSwap16HostToLittle(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to little endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint32_t Swap32HostToLittle(uint32_t inValue)
+ {
+ return nlByteOrderSwap32HostToLittle(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to little endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this is a no-op and
+ * on big endian target systems, this performs a reordering.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint64_t Swap64HostToLittle(uint64_t inValue)
+ {
+ return nlByteOrderSwap64HostToLittle(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in big endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint16_t Swap16BigToHost(uint16_t inValue)
+ {
+ return nlByteOrderSwap16BigToHost(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in big endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint32_t Swap32BigToHost(uint32_t inValue)
+ {
+ return nlByteOrderSwap32BigToHost(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in big endian byte ordering to the target system (i.e. host)
+ * byte ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint64_t Swap64BigToHost(uint64_t inValue)
+ {
+ return nlByteOrderSwap64BigToHost(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 16-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to big endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 16-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint16_t Swap16HostToBig(uint16_t inValue)
+ {
+ return nlByteOrderSwap16HostToBig(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 32-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to big endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 32-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint32_t Swap32HostToBig(uint32_t inValue)
+ {
+ return nlByteOrderSwap32HostToBig(inValue);
+ }
+
+ /**
+ * This conditionally performs, as necessary for the target system, a
+ * byte order swap by value of the specified 64-bit value, presumed to
+ * be in target system (i.e. host) byte ordering to big endian byte
+ * ordering.
+ *
+ * Consequently, on little endian target systems, this performs a
+ * reordering and on big endian target systems, this is a no-op.
+ *
+ * @param[in] inValue The 64-bit value to be byte order swapped.
+ *
+ * @return The input value, byte order swapped.
+ */
+ inline uint64_t Swap64HostToBig(uint64_t inValue)
+ {
+ return nlByteOrderSwap64HostToBig(inValue);
+ }
+
+ }; // namespace ByteOrder
+
+}; // namespace nl
+
+#endif // NLBYTEORDER_HPP
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/include/nlio-base.h b/include/nlio-base.h
new file mode 100644
index 0000000..f24a51e
--- /dev/null
+++ b/include/nlio-base.h
@@ -0,0 +1,1108 @@
+/**
+ * Copyright 2013-2017 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines C functions for safely performing simple,
+ * memory-mapped accesses, potentially to unaligned memory
+ * locations.
+ */
+
+#ifndef NLIO_BASE_H
+#define NLIO_BASE_H
+
+#include <nlio-private.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+
+/*
+ * If we are compiling under clang, GCC, or any such compatible
+ * compiler, in which -fno-builtins or -ffreestanding might be
+ * asserted, thereby eliminating built-in function optimization, we
+ * STILL want built-in memcpy. We want this because it allows the
+ * compiler to use architecture-specific machine instructions or
+ * inline code generation to optimize an otherwise-expensive memcpy
+ * for unaligned reads and writes, which is exactly the kind of
+ * efficiency that would be expected of nlIO.
+ */
+#if __nlIOHasBuiltin(__builtin_memcpy)
+#define __nlIO_MEMCPY __builtin_memcpy
+#else
+#define __nlIO_MEMCPY memcpy
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * This determines whether the specified pointer is aligned on the
+ * indicated size boundary.
+ *
+ * @note The size should be a power of 2 (e.g. 1, 2, 4, 8, 16, etc.).
+ *
+ * @param[in] p The pointer to check the alignment of.
+ * @param[in] size The size, in bytes, boundary to check
+ * the alignment against.
+ *
+ * @return True if the pointer is aligned to the specified size;
+ * otherwise, false.
+ */
+static inline bool nlIOIsAligned(const void *p, size_t size)
+{
+ const uintptr_t value = (uintptr_t)(p);
+ const uintptr_t mask = size - 1;
+
+ return ((value & mask) == 0);
+}
+
+/**
+ * Perform an aligned memory read of the 8-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 8-bit value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOGetAligned8(const void *p)
+{
+ return *(const uint8_t *)(p);
+}
+
+/**
+ * Perform an aligned memory read of the 16-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 16-bit value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOGetAligned16(const void *p)
+{
+ return *(const uint16_t *)(p);
+}
+
+/**
+ * Perform an aligned memory read of the 32-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 32-bit value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOGetAligned32(const void *p)
+{
+ return *(const uint32_t *)(p);
+}
+
+/**
+ * Perform an aligned memory read of the 64-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 64-bit value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOGetAligned64(const void *p)
+{
+ return *(const uint64_t *)(p);
+}
+
+/**
+ * Perform an unaligned memory read of the 8-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 8-bit value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOGetUnaligned8(const void *p)
+{
+ return nlIOGetAligned8(p);
+}
+
+/**
+ * Perform an unaligned memory read of the 16-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 16-bit value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOGetUnaligned16(const void *p)
+{
+ uint16_t temp;
+
+ __nlIO_MEMCPY(&temp, p, sizeof(uint16_t));
+
+ return temp;
+}
+
+/**
+ * Perform an unaligned memory read of the 32-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 32-bit value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOGetUnaligned32(const void *p)
+{
+ uint32_t temp;
+
+ __nlIO_MEMCPY(&temp, p, sizeof(uint32_t));
+
+ return temp;
+}
+
+/**
+ * Perform an unaligned memory read of the 64-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 64-bit value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOGetUnaligned64(const void *p)
+{
+ uint64_t temp;
+
+ __nlIO_MEMCPY(&temp, p, sizeof(uint64_t));
+
+ return temp;
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 8-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 8-bit value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOGetMaybeAligned8(const void *p)
+{
+ return nlIOGetAligned8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 16-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 16-bit value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOGetMaybeAligned16(const void *p)
+{
+ if (nlIOIsAligned(p, sizeof (uint16_t)))
+ return nlIOGetAligned16(p);
+ else
+ return nlIOGetUnaligned16(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 32-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 32-bit value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOGetMaybeAligned32(const void *p)
+{
+ if (nlIOIsAligned(p, sizeof (uint32_t)))
+ return nlIOGetAligned32(p);
+ else
+ return nlIOGetUnaligned32(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 64-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 64-bit value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOGetMaybeAligned64(const void *p)
+{
+ if (nlIOIsAligned(p, sizeof (uint64_t)))
+ return nlIOGetAligned64(p);
+ else
+ return nlIOGetUnaligned64(p);
+}
+
+/**
+ * Perform an aligned memory write of the 8-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 8-bit value to.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOPutAligned8(void *p, const uint8_t v)
+{
+ *(uint8_t *)(p) = v;
+}
+
+/**
+ * Perform an aligned memory write of the 16-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 16-bit value to.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOPutAligned16(void *p, const uint16_t v)
+{
+ *(uint16_t *)(p) = v;
+}
+
+/**
+ * Perform an aligned memory write of the 32-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 32-bit value to.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOPutAligned32(void *p, const uint32_t v)
+{
+ *(uint32_t *)(p) = v;
+}
+
+/**
+ * Perform an aligned memory write of the 64-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 64-bit value to.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOPutAligned64(void *p, const uint64_t v)
+{
+ *(uint64_t *)(p) = v;
+}
+
+/**
+ * Perform an unaligned memory write of the 8-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 8-bit value to.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOPutUnaligned8(void *p, const uint8_t v)
+{
+ nlIOPutAligned8(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the 16-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 16-bit value to.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOPutUnaligned16(void *p, const uint16_t v)
+{
+ __nlIO_MEMCPY(p, &v, sizeof(uint16_t));
+}
+
+/**
+ * Perform an unaligned memory write of the 32-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 32-bit value to.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOPutUnaligned32(void *p, const uint32_t v)
+{
+ __nlIO_MEMCPY(p, &v, sizeof(uint32_t));
+}
+
+/**
+ * Perform an unaligned memory write of the 64-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 64-bit value to.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOPutUnaligned64(void *p, const uint64_t v)
+{
+ __nlIO_MEMCPY(p, &v, sizeof(uint64_t));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 8-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 8-bit value to.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOPutMaybeAligned8(void *p, const uint8_t v)
+{
+ nlIOPutAligned8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 16-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 16-bit value to.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOPutMaybeAligned16(void *p, const uint16_t v)
+{
+ if (nlIOIsAligned(p, sizeof (uint16_t)))
+ nlIOPutAligned16(p, v);
+ else
+ nlIOPutUnaligned16(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 32-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 32-bit value to.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOPutMaybeAligned32(void *p, const uint32_t v)
+{
+ if (nlIOIsAligned(p, sizeof (uint32_t)))
+ nlIOPutAligned32(p, v);
+ else
+ nlIOPutUnaligned32(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 64-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 64-bit value to.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOPutMaybeAligned64(void *p, const uint64_t v)
+{
+ if (nlIOIsAligned(p, sizeof (uint64_t)))
+ nlIOPutAligned64(p, v);
+ else
+ nlIOPutUnaligned64(p, v);
+}
+
+/**
+ * Perform an aligned memory read of the 8-bit value at the specified
+ * pointer address and increment the pointer by 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to a pointer address to read the
+ * 8-bit value from and to then increment by
+ * 8-bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOReadAligned8(const void **p)
+{
+ const uint8_t temp = nlIOGetAligned8(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint8_t);
+
+ return temp;
+}
+
+/**
+ * Perform an aligned memory read of the 16-bit value at the specified
+ * pointer address and increment the pointer by 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the
+ * 16-bit value from and to then increment by
+ * 16-bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOReadAligned16(const void **p)
+{
+ const uint16_t temp = nlIOGetAligned16(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint16_t);
+
+ return temp;
+}
+
+/**
+ * Perform an aligned memory read of the 32-bit value at the specified
+ * pointer address and increment the pointer by 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the
+ * 32-bit value from and to then increment by
+ * 32-bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOReadAligned32(const void **p)
+{
+ const uint32_t temp = nlIOGetAligned32(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint32_t);
+
+ return temp;
+}
+
+/**
+ * Perform an aligned memory read of the 64-bit value at the specified
+ * pointer address and increment the pointer by 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the
+ * 64-bit value from and to then increment by
+ * 64-bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOReadAligned64(const void **p)
+{
+ const uint64_t temp = nlIOGetAligned64(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint64_t);
+
+ return temp;
+}
+
+/**
+ * Perform an unaligned memory read of the 8-bit value at the specified
+ * pointer address and increment the pointer by 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to a pointer address to read the
+ * 8-bit value from and to then increment by
+ * 8-bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOReadUnaligned8(const void **p)
+{
+ const uint8_t temp = nlIOGetUnaligned8(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint8_t);
+
+ return temp;
+}
+
+/**
+ * Perform an unaligned memory read of the 16-bit value at the specified
+ * pointer address and increment the pointer by 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the
+ * 16-bit value from and to then increment by
+ * 16-bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOReadUnaligned16(const void **p)
+{
+ const uint16_t temp = nlIOGetUnaligned16(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint16_t);
+
+ return temp;
+}
+
+/**
+ * Perform an aligned memory read of the 32-bit value at the specified
+ * pointer address and increment the pointer by 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the
+ * 32-bit value from and to then increment by
+ * 32-bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOReadUnaligned32(const void **p)
+{
+ const uint32_t temp = nlIOGetUnaligned32(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint32_t);
+
+ return temp;
+}
+
+/**
+ * Perform an unaligned memory read of the 64-bit value at the specified
+ * pointer address and increment the pointer by 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the
+ * 64-bit value from and to then increment by
+ * 64-bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOReadUnaligned64(const void **p)
+{
+ const uint64_t temp = nlIOGetUnaligned64(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint64_t);
+
+ return temp;
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 8-bit value
+ * from the specified pointer address and increment the pointer by
+ * 8-bits (1 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 8-bit value from and to
+ * then increment by 8-bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOReadMaybeAligned8(const void **p)
+{
+ const uint8_t temp = nlIOGetMaybeAligned8(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint8_t);
+
+ return temp;
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 16-bit value
+ * from the specified pointer address and increment the pointer by
+ * 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 16-bit value from and to
+ * then increment by 16-bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOReadMaybeAligned16(const void **p)
+{
+ const uint16_t temp = nlIOGetMaybeAligned16(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint16_t);
+
+ return temp;
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 32-bit value
+ * from the specified pointer address and increment the pointer by
+ * 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 32-bit value from and to
+ * then increment by 32-bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOReadMaybeAligned32(const void **p)
+{
+ const uint32_t temp = nlIOGetMaybeAligned32(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint32_t);
+
+ return temp;
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 64-bit value
+ * from the specified pointer address and increment the pointer by
+ * 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 64-bit value from and to
+ * then increment by 64-bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOReadMaybeAligned64(const void **p)
+{
+ const uint64_t temp = nlIOGetMaybeAligned64(*p);
+
+ *(const uint8_t **)(p) += sizeof (uint64_t);
+
+ return temp;
+}
+
+/**
+ * Perform an aligned memory write of the 8-bit value to the specified
+ * pointer address and increment the pointer by 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to a pointer address to read the 8-bit
+ * value from and to then increment by 8-bits (1 byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOWriteAligned8(void **p, const uint8_t v)
+{
+ nlIOPutAligned8(*p, v); *(const uint8_t **)(p) += sizeof (uint8_t);
+}
+
+/**
+ * Perform an aligned memory write of the 16-bit value to the specified
+ * pointer address and increment the pointer by 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the 16-bit
+ * value from and to then increment by 16-bits (2 bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOWriteAligned16(void **p, const uint16_t v)
+{
+ nlIOPutAligned16(*p, v); *(const uint8_t **)(p) += sizeof (uint16_t);
+}
+
+/**
+ * Perform an aligned memory write of the 32-bit value to the specified
+ * pointer address and increment the pointer by 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the 32-bit
+ * value from and to then increment by 32-bits (4 bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOWriteAligned32(void **p, const uint32_t v)
+{
+ nlIOPutAligned32(*p, v); *(const uint8_t **)(p) += sizeof (uint32_t);
+}
+
+/**
+ * Perform an aligned memory write of the 64-bit value to the specified
+ * pointer address and increment the pointer by 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the 64-bit
+ * value from and to then increment by 64-bits (8 bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOWriteAligned64(void **p, const uint64_t v)
+{
+ nlIOPutAligned64(*p, v); *(const uint8_t **)(p) += sizeof (uint64_t);
+}
+
+/**
+ * Perform an unaligned memory write of the 8-bit value to the specified
+ * pointer address and increment the pointer by 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to a pointer address to read the 8-bit
+ * value from and to then increment by 8-bits (1 byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOWriteUnaligned8(void **p, const uint8_t v)
+{
+ nlIOPutUnaligned8(*p, v); *(const uint8_t **)(p) += sizeof (uint8_t);
+}
+
+/**
+ * Perform an unaligned memory write of the 16-bit value to the specified
+ * pointer address and increment the pointer by 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the 16-bit
+ * value from and to then increment by 16-bits (2 bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOWriteUnaligned16(void **p, const uint16_t v)
+{
+ nlIOPutUnaligned16(*p, v); *(const uint8_t **)(p) += sizeof (uint16_t);
+}
+
+/**
+ * Perform an unaligned memory write of the 32-bit value to the specified
+ * pointer address and increment the pointer by 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the 32-bit
+ * value from and to then increment by 32-bits (4 bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOWriteUnaligned32(void **p, const uint32_t v)
+{
+ nlIOPutUnaligned32(*p, v); *(const uint8_t **)(p) += sizeof (uint32_t);
+}
+
+/**
+ * Perform an unaligned memory write of the 64-bit value to the specified
+ * pointer address and increment the pointer by 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address to read the 64-bit
+ * value from and to then increment by 64-bits (8 bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOWriteUnaligned64(void **p, const uint64_t v)
+{
+ nlIOPutUnaligned64(*p, v); *(const uint8_t **)(p) += sizeof (uint64_t);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 8-bit value
+ * to the specified pointer address and increment the pointer by
+ * 8-bits (2 byte).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 8-bit value from and to
+ * then increment by 8-bits (1 byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOWriteMaybeAligned8(void **p, const uint8_t v)
+{
+ nlIOPutMaybeAligned8(*p, v); *(const uint8_t **)(p) += sizeof (uint8_t);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 16-bit value
+ * to the specified pointer address and increment the pointer by
+ * 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 16-bit value from and to
+ * then increment by 16-bits (2 bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOWriteMaybeAligned16(void **p, const uint16_t v)
+{
+ nlIOPutMaybeAligned16(*p, v); *(const uint8_t **)(p) += sizeof (uint16_t);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 32-bit value
+ * to the specified pointer address and increment the pointer by
+ * 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 32-bit value from and to
+ * then increment by 32-bits (4 bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOWriteMaybeAligned32(void **p, const uint32_t v)
+{
+ nlIOPutMaybeAligned32(*p, v); *(const uint8_t **)(p) += sizeof (uint32_t);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 64-bit value
+ * to the specified pointer address and increment the pointer by
+ * 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 64-bit value from and to
+ * then increment by 64-bits (8 bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOWriteMaybeAligned64(void **p, const uint64_t v)
+{
+ nlIOPutMaybeAligned64(*p, v); *(const uint8_t **)(p) += sizeof (uint64_t);
+}
+
+/**
+ * Perform a memory read of the 8-bit value at the specified pointer
+ * address.
+ *
+ * @param[in] p A pointer address to read the 8-bit value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOGet8(const void *p)
+{
+ return nlIOGetAligned8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 16-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 16-bit value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOGet16(const void *p)
+{
+ return nlIOGetMaybeAligned16(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 32-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 32-bit value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOGet32(const void *p)
+{
+ return nlIOGetMaybeAligned32(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 64-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 64-bit value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOGet64(const void *p)
+{
+ return nlIOGetMaybeAligned64(p);
+}
+
+/**
+ * Perform a memory write of the 8-bit value to the specified pointer
+ * address.
+ *
+ * @param[in] p A pointer address to write the 8-bit value to.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOPut8(void *p, uint8_t v)
+{
+ nlIOPutAligned8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 16-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 16-bit value to.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOPut16(void *p, uint16_t v)
+{
+ nlIOPutMaybeAligned16(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 32-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 32-bit value to.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOPut32(void *p, uint32_t v)
+{
+ nlIOPutMaybeAligned32(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 64-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 64-bit value to.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOPut64(void *p, uint64_t v)
+{
+ nlIOPutMaybeAligned64(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 16-bit value
+ * from the specified pointer address and increment the pointer by
+ * 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 8-bit value from and to
+ * then increment by 8-bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIORead8(const void **p)
+{
+ return nlIOReadAligned8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 16-bit value
+ * from the specified pointer address and increment the pointer by
+ * 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 16-bit value from and to
+ * then increment by 16-bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIORead16(const void **p)
+{
+ return nlIOReadMaybeAligned16(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 32-bit value
+ * from the specified pointer address and increment the pointer by
+ * 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 32-bit value from and to
+ * then increment by 32-bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIORead32(const void **p)
+{
+ return nlIOReadMaybeAligned32(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 64-bit value
+ * from the specified pointer address and increment the pointer by
+ * 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 64-bit value from and to
+ * then increment by 64-bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIORead64(const void **p)
+{
+ return nlIOReadMaybeAligned64(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 8-bit value
+ * to the specified pointer address and increment the pointer by
+ * 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 8-bit value from and to
+ * then increment by 8-bits (1 byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOWrite8(void **p, uint8_t v)
+{
+ nlIOWriteAligned8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 16-bit value
+ * to the specified pointer address and increment the pointer by
+ * 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 16-bit value from and to
+ * then increment by 16-bits (2 bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOWrite16(void **p, uint16_t v)
+{
+ nlIOWriteMaybeAligned16(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 32-bit value
+ * to the specified pointer address and increment the pointer by
+ * 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 32-bit value from and to
+ * then increment by 32-bits (4 bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOWrite32(void **p, uint32_t v)
+{
+ nlIOWriteMaybeAligned32(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 64-bit value
+ * to the specified pointer address and increment the pointer by
+ * 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 64-bit value from and to
+ * then increment by 64-bits (8 bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOWrite64(void **p, uint64_t v)
+{
+ nlIOWriteMaybeAligned64(p, v);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#undef __nlIO_MEMCPY
+
+#endif /* NLIO_BASE_H */
diff --git a/include/nlio-base.hpp b/include/nlio-base.hpp
new file mode 100644
index 0000000..4be7a03
--- /dev/null
+++ b/include/nlio-base.hpp
@@ -0,0 +1,1025 @@
+/**
+ * Copyright 2013-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines C++ functions for safely performing simple,
+ * memory-mapped accesses, potentially to unaligned memory
+ * locations.
+ */
+
+#ifndef NLIO_BASE_HPP
+#define NLIO_BASE_HPP
+
+#include <nlio-base.h>
+
+namespace nl
+{
+
+namespace IO
+{
+
+/**
+ * This determines whether the specified pointer is aligned on the
+ * indicated size boundary.
+ *
+ * @note The size should be a power of 2 (e.g. 1, 2, 4, 8, 16, etc.).
+ *
+ * @param[in] p The pointer to check the alignment of.
+ * @param[in] size The size, in bytes, boundary to check
+ * the alignment against.
+ *
+ * @return True if the pointer is aligned to the specified size;
+ * otherwise, false.
+ */
+static inline bool IsAligned(const void *p, size_t size)
+{
+ return nlIOIsAligned(p, size);
+}
+
+/**
+ * This determines whether the specified pointer is aligned on the
+ * size boundary for the template type, T.
+ *
+ * @tparam T The type of pointer to check the alignment of.
+ *
+ * @param[in] p The pointer to check the alignment of.
+ *
+ * @return True if the pointer is aligned to size of the type;
+ * otherwise, false.
+ */
+template <typename T>
+static inline bool IsAligned(const T *p)
+{
+ return nlIOIsAligned(p, sizeof(T));
+}
+
+/**
+ * Perform an aligned memory read of the 8-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 8-bit value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t GetAligned8(const void *p)
+{
+ return nlIOGetAligned8(p);
+}
+
+/**
+ * Perform an aligned memory read of the 16-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 16-bit value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t GetAligned16(const void *p)
+{
+ return nlIOGetAligned16(p);
+}
+
+/**
+ * Perform an aligned memory read of the 32-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 32-bit value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t GetAligned32(const void *p)
+{
+ return nlIOGetAligned32(p);
+}
+
+/**
+ * Perform an aligned memory read of the 64-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 64-bit value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t GetAligned64(const void *p)
+{
+ return nlIOGetAligned64(p);
+}
+
+/**
+ * Perform an unaligned memory read of the 8-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 8-bit value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t GetUnaligned8(const void *p)
+{
+ return nlIOGetUnaligned8(p);
+}
+
+/**
+ * Perform an unaligned memory read of the 16-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 16-bit value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t GetUnaligned16(const void *p)
+{
+ return nlIOGetUnaligned16(p);
+}
+
+/**
+ * Perform an unaligned memory read of the 32-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 32-bit value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t GetUnaligned32(const void *p)
+{
+ return nlIOGetUnaligned32(p);
+}
+
+/**
+ * Perform an unaligned memory read of the 64-bit value at the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to read the 64-bit value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t GetUnaligned64(const void *p)
+{
+ return nlIOGetUnaligned64(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 8-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 8-bit value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t GetMaybeAligned8(const void *p)
+{
+ return nlIOGetMaybeAligned8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 16-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 16-bit value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t GetMaybeAligned16(const void *p)
+{
+ return nlIOGetMaybeAligned16(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 32-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 32-bit value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t GetMaybeAligned32(const void *p)
+{
+ return nlIOGetMaybeAligned32(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 64-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 64-bit value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t GetMaybeAligned64(const void *p)
+{
+ return nlIOGetMaybeAligned64(p);
+}
+
+/**
+ * Perform an aligned memory write of the 8-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 8-bit value to.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void PutAligned8(void *p, const uint8_t v)
+{
+ nlIOPutAligned8(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the 16-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 16-bit value to.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void PutAligned16(void *p, const uint16_t v)
+{
+ nlIOPutAligned16(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the 32-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 32-bit value to.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void PutAligned32(void *p, const uint32_t v)
+{
+ nlIOPutAligned32(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the 64-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 64-bit value to.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void PutAligned64(void *p, const uint64_t v)
+{
+ nlIOPutAligned64(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the 8-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 8-bit value to.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void PutUnaligned8(void *p, const uint8_t v)
+{
+ nlIOPutUnaligned8(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the 16-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 16-bit value to.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void PutUnaligned16(void *p, const uint16_t v)
+{
+ nlIOPutUnaligned16(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the 32-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 32-bit value to.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void PutUnaligned32(void *p, const uint32_t v)
+{
+ nlIOPutUnaligned32(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the 64-bit value to the specified
+ * pointer address.
+ *
+ * @param[in] p A pointer address to write the 64-bit value to.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void PutUnaligned64(void *p, const uint64_t v)
+{
+ nlIOPutUnaligned64(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 8-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 8-bit value to.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void PutMaybeAligned8(void *p, const uint8_t v)
+{
+ nlIOPutMaybeAligned8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 16-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 16-bit value to.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void PutMaybeAligned16(void *p, const uint16_t v)
+{
+ nlIOPutMaybeAligned16(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 32-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 32-bit value to.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void PutMaybeAligned32(void *p, const uint32_t v)
+{
+ nlIOPutMaybeAligned32(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 64-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 64-bit value to.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void PutMaybeAligned64(void *p, const uint64_t v)
+{
+ nlIOPutMaybeAligned64(p, v);
+}
+
+/**
+ * Perform an aligned memory read of the 8-bit value at the specified
+ * pointer address and increment the pointer by 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to a pointer address to read the
+ * 8-bit value from and to then increment by
+ * 8-bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t ReadAligned8(const void *&p)
+{
+ return nlIOReadAligned8(&p);
+}
+
+/**
+ * Perform an aligned memory read of the 16-bit value at the specified
+ * pointer address and increment the pointer by 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the
+ * 16-bit value from and to then increment by
+ * 16-bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t ReadAligned16(const void *&p)
+{
+ return nlIOReadAligned16(&p);
+}
+
+/**
+ * Perform an aligned memory read of the 32-bit value at the specified
+ * pointer address and increment the pointer by 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the
+ * 32-bit value from and to then increment by
+ * 32-bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t ReadAligned32(const void *&p)
+{
+ return nlIOReadAligned32(&p);
+}
+
+/**
+ * Perform an aligned memory read of the 64-bit value at the specified
+ * pointer address and increment the pointer by 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the
+ * 64-bit value from and to then increment by
+ * 64-bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t ReadAligned64(const void *&p)
+{
+ return nlIOReadAligned64(&p);
+}
+
+/**
+ * Perform an unaligned memory read of the 8-bit value at the specified
+ * pointer address and increment the pointer by 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to a pointer address to read the
+ * 8-bit value from and to then increment by
+ * 8-bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t ReadUnaligned8(const void *&p)
+{
+ return nlIOReadUnaligned8(&p);
+}
+
+/**
+ * Perform an unaligned memory read of the 16-bit value at the specified
+ * pointer address and increment the pointer by 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the
+ * 16-bit value from and to then increment by
+ * 16-bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t ReadUnaligned16(const void *&p)
+{
+ return nlIOReadUnaligned16(&p);
+}
+
+/**
+ * Perform an aligned memory read of the 32-bit value at the specified
+ * pointer address and increment the pointer by 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the
+ * 32-bit value from and to then increment by
+ * 32-bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t ReadUnaligned32(const void *&p)
+{
+ return nlIOReadUnaligned32(&p);
+}
+
+/**
+ * Perform an unaligned memory read of the 64-bit value at the specified
+ * pointer address and increment the pointer by 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the
+ * 64-bit value from and to then increment by
+ * 64-bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t ReadUnaligned64(const void *&p)
+{
+ return nlIOReadUnaligned64(&p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 8-bit value
+ * from the specified pointer address and increment the pointer by
+ * 8-bits (1 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 8-bit value from and to
+ * then increment by 8-bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t ReadMaybeAligned8(const void *&p)
+{
+ return nlIOReadMaybeAligned8(&p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 16-bit value
+ * from the specified pointer address and increment the pointer by
+ * 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 16-bit value from and to
+ * then increment by 16-bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t ReadMaybeAligned16(const void *&p)
+{
+ return nlIOReadMaybeAligned16(&p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 32-bit value
+ * from the specified pointer address and increment the pointer by
+ * 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 32-bit value from and to
+ * then increment by 32-bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t ReadMaybeAligned32(const void *&p)
+{
+ return nlIOReadMaybeAligned32(&p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 64-bit value
+ * from the specified pointer address and increment the pointer by
+ * 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 64-bit value from and to
+ * then increment by 64-bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t ReadMaybeAligned64(const void *&p)
+{
+ return nlIOReadMaybeAligned64(&p);
+}
+
+/**
+ * Perform an aligned memory write of the 8-bit value to the specified
+ * pointer address and increment the pointer by 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to a pointer address to read the 8-bit
+ * value from and to then increment by 8-bits (1 byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void WriteAligned8(void *&p, const uint8_t v)
+{
+ nlIOWriteAligned8(&p, v);
+}
+
+/**
+ * Perform an aligned memory write of the 16-bit value to the specified
+ * pointer address and increment the pointer by 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the 16-bit
+ * value from and to then increment by 16-bits (2 bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void WriteAligned16(void *&p, const uint16_t v)
+{
+ nlIOWriteAligned16(&p, v);
+}
+
+/**
+ * Perform an aligned memory write of the 32-bit value to the specified
+ * pointer address and increment the pointer by 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the 32-bit
+ * value from and to then increment by 32-bits (4 bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void WriteAligned32(void *&p, const uint32_t v)
+{
+ nlIOWriteAligned32(&p, v);
+}
+
+/**
+ * Perform an aligned memory write of the 64-bit value to the specified
+ * pointer address and increment the pointer by 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the 64-bit
+ * value from and to then increment by 64-bits (8 bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void WriteAligned64(void *&p, const uint64_t v)
+{
+ nlIOWriteAligned64(&p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the 8-bit value to the specified
+ * pointer address and increment the pointer by 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to a pointer address to read the 8-bit
+ * value from and to then increment by 8-bits (1 byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void WriteUnaligned8(void *&p, const uint8_t v)
+{
+ nlIOWriteUnaligned8(&p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the 16-bit value to the specified
+ * pointer address and increment the pointer by 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the 16-bit
+ * value from and to then increment by 16-bits (2 bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void WriteUnaligned16(void *&p, const uint16_t v)
+{
+ nlIOWriteUnaligned16(&p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the 32-bit value to the specified
+ * pointer address and increment the pointer by 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the 32-bit
+ * value from and to then increment by 32-bits (4 bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void WriteUnaligned32(void *&p, const uint32_t v)
+{
+ nlIOWriteUnaligned32(&p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the 64-bit value to the specified
+ * pointer address and increment the pointer by 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to a pointer address to read the 64-bit
+ * value from and to then increment by 64-bits (8 bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void WriteUnaligned64(void *&p, const uint64_t v)
+{
+ nlIOWriteUnaligned64(&p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 8-bit value
+ * to the specified pointer address and increment the pointer by
+ * 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 8-bit value from and to
+ * then increment by 8-bits (1 byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void WriteMaybeAligned8(void *&p, const uint8_t v)
+{
+ nlIOWriteMaybeAligned8(&p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 16-bit value
+ * to the specified pointer address and increment the pointer by
+ * 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 16-bit value from and to
+ * then increment by 16-bits (2 bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void WriteMaybeAligned16(void *&p, const uint16_t v)
+{
+ nlIOWriteMaybeAligned16(&p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 32-bit value
+ * to the specified pointer address and increment the pointer by
+ * 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 32-bit value from and to
+ * then increment by 32-bits (4 bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void WriteMaybeAligned32(void *&p, const uint32_t v)
+{
+ nlIOWriteMaybeAligned32(&p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 64-bit value
+ * to the specified pointer address and increment the pointer by
+ * 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 64-bit value from and to
+ * then increment by 64-bits (8 bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void WriteMaybeAligned64(void *&p, const uint64_t v)
+{
+ nlIOWriteMaybeAligned64(&p, v);
+}
+
+/**
+ * Perform a memory read of the 8-bit value at the specified pointer
+ * address.
+ *
+ * @param[in] p A pointer address to read the 8-bit value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t Get8(const void *p)
+{
+ return nlIOGet8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 16-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 16-bit value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t Get16(const void *p)
+{
+ return nlIOGet16(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 32-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 32-bit value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t Get32(const void *p)
+{
+ return nlIOGet32(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 64-bit value
+ * from the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 64-bit value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t Get64(const void *p)
+{
+ return nlIOGet64(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 8-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 8-bit value to.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void Put8(void *p, const uint8_t v)
+{
+ nlIOPut8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 16-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 16-bit value to.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void Put16(void *p, const uint16_t v)
+{
+ nlIOPut16(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 32-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 32-bit value to.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void Put32(void *p, const uint32_t v)
+{
+ nlIOPut32(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 64-bit value
+ * to the specified pointer address.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the 64-bit value to.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void Put64(void *p, const uint64_t v)
+{
+ nlIOPut64(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 16-bit value
+ * from the specified pointer address and increment the pointer by
+ * 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 8-bit value from and to
+ * then increment by 8-bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t Read8(const void *&p)
+{
+ return nlIORead8(&p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 16-bit value
+ * from the specified pointer address and increment the pointer by
+ * 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 16-bit value from and to
+ * then increment by 16-bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t Read16(const void *&p)
+{
+ return nlIORead16(&p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 32-bit value
+ * from the specified pointer address and increment the pointer by
+ * 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 32-bit value from and to
+ * then increment by 32-bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t Read32(const void *&p)
+{
+ return nlIORead32(&p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the 64-bit value
+ * from the specified pointer address and increment the pointer by
+ * 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 64-bit value from and to
+ * then increment by 64-bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t Read64(const void *&p)
+{
+ return nlIORead64(&p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 8-bit value
+ * to the specified pointer address and increment the pointer by
+ * 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 8-bit value from and to
+ * then increment by 8-bits (1 byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void Write8(void *&p, const uint8_t v)
+{
+ nlIOWrite8(&p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 16-bit value
+ * to the specified pointer address and increment the pointer by
+ * 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 16-bit value from and to
+ * then increment by 16-bits (2 bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void Write16(void *&p, const uint16_t v)
+{
+ nlIOWrite16(&p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 32-bit value
+ * to the specified pointer address and increment the pointer by
+ * 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 32-bit value from and to
+ * then increment by 32-bits (4 bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void Write32(void *&p, const uint32_t v)
+{
+ nlIOWrite32(&p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the 64-bit value
+ * to the specified pointer address and increment the pointer by
+ * 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 64-bit value from and to
+ * then increment by 64-bits (8 bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void Write64(void *&p, const uint64_t v)
+{
+ nlIOWrite64(&p, v);
+}
+
+}; // namespace IO
+
+}; // namespace nl
+
+#endif // NLIO_BASE_HPP
diff --git a/include/nlio-byteorder-big.h b/include/nlio-byteorder-big.h
new file mode 100644
index 0000000..a9ab69c
--- /dev/null
+++ b/include/nlio-byteorder-big.h
@@ -0,0 +1,915 @@
+/**
+ * Copyright 2013-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines C functions for safely performing simple,
+ * memory-mapped accesses, potentially to unaligned, aligned, and
+ * unaligned memory locations with byte reordering, specifically
+ * for big endian target systems.
+ */
+
+#ifndef NLIO_BYTEORDER_BIG_H
+#define NLIO_BYTEORDER_BIG_H
+
+#include <nlio-base.h>
+#include <nlbyteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 8-bit big endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOBigEndianGet8(const void *p)
+{
+ return nlIOGet8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 16-bit big endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOBigEndianGet16(const void *p)
+{
+ return nlByteOrderSwap16BigToHost(nlIOGet16(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 32-bit big endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOBigEndianGet32(const void *p)
+{
+ return nlByteOrderSwap32BigToHost(nlIOGet32(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 64-bit big endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOBigEndianGet64(const void *p)
+{
+ return nlByteOrderSwap64BigToHost(nlIOGet64(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 8-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPut8(void *p, uint8_t v)
+{
+ nlIOPut8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 16-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPut16(void *p, uint16_t v)
+{
+ nlIOPut16(p, nlByteOrderSwap16HostToBig(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 32-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPut32(void *p, uint32_t v)
+{
+ nlIOPut32(p, nlByteOrderSwap32HostToBig(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 64-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPut64(void *p, uint64_t v)
+{
+ nlIOPut64(p, nlByteOrderSwap64HostToBig(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 8-bit big endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOBigEndianRead8(const void **p)
+{
+ return nlIORead8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 16-bit big endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOBigEndianRead16(const void **p)
+{
+ return nlByteOrderSwap16BigToHost(nlIORead16(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 32-bit big endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOBigEndianRead32(const void **p)
+{
+ return nlByteOrderSwap32BigToHost(nlIORead32(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 64-bit big endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOBigEndianRead64(const void **p)
+{
+ return nlByteOrderSwap64BigToHost(nlIORead64(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 8-bit value to in big endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWrite8(void **p, uint8_t v)
+{
+ nlIOWrite8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 16-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWrite16(void **p, uint16_t v)
+{
+ nlIOWrite16(p, nlByteOrderSwap16HostToBig(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 32-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWrite32(void **p, uint32_t v)
+{
+ nlIOWrite32(p, nlByteOrderSwap32HostToBig(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 64-bit value to in big endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWrite64(void **p, uint64_t v)
+{
+ nlIOWrite64(p, nlByteOrderSwap64HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 8-bit big endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOBigEndianGetAligned8(const void *p)
+{
+ return nlIOGetAligned8(p);
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 16-bit big endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOBigEndianGetAligned16(const void *p)
+{
+ return nlByteOrderSwap16BigToHost(nlIOGetAligned16(p));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 32-bit big endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOBigEndianGetAligned32(const void *p)
+{
+ return nlByteOrderSwap32BigToHost(nlIOGetAligned32(p));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 64-bit big endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOBigEndianGetAligned64(const void *p)
+{
+ return nlByteOrderSwap64BigToHost(nlIOGetAligned64(p));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 8-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPutAligned8(void *p, uint8_t v)
+{
+ nlIOPutAligned8(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 16-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPutAligned16(void *p, uint16_t v)
+{
+ nlIOPutAligned16(p, nlByteOrderSwap16HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 32-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPutAligned32(void *p, uint32_t v)
+{
+ nlIOPutAligned32(p, nlByteOrderSwap32HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 64-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPutAligned64(void *p, uint64_t v)
+{
+ nlIOPutAligned64(p, nlByteOrderSwap64HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to read the 8-bit big endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOBigEndianReadAligned8(const void **p)
+{
+ return nlIOReadAligned8(p);
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to read the 16-bit big endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOBigEndianReadAligned16(const void **p)
+{
+ return nlByteOrderSwap16BigToHost(nlIOReadAligned16(p));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to read the 32-bit big endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOBigEndianReadAligned32(const void **p)
+{
+ return nlByteOrderSwap32BigToHost(nlIOReadAligned32(p));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to read the 64-bit big endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOBigEndianReadAligned64(const void **p)
+{
+ return nlByteOrderSwap64BigToHost(nlIOReadAligned64(p));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to write the target system byte
+ * ordered 8-bit value to in big endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWriteAligned8(void **p, uint8_t v)
+{
+ nlIOWriteAligned8(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to write the target system byte
+ * ordered 16-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWriteAligned16(void **p, uint16_t v)
+{
+ nlIOWriteAligned16(p, nlByteOrderSwap16HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to write the target system byte
+ * ordered 32-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWriteAligned32(void **p, uint32_t v)
+{
+ nlIOWriteAligned32(p, nlByteOrderSwap32HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to write the target system byte
+ * ordered 64-bit value to in big endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWriteAligned64(void **p, uint64_t v)
+{
+ nlIOWriteAligned64(p, nlByteOrderSwap64HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 8-bit big endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOBigEndianGetUnaligned8(const void *p)
+{
+ return nlIOGetUnaligned8(p);
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 16-bit big endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOBigEndianGetUnaligned16(const void *p)
+{
+ return nlByteOrderSwap16BigToHost(nlIOGetUnaligned16(p));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 32-bit big endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOBigEndianGetUnaligned32(const void *p)
+{
+ return nlByteOrderSwap32BigToHost(nlIOGetUnaligned32(p));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 64-bit big endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOBigEndianGetUnaligned64(const void *p)
+{
+ return nlByteOrderSwap64BigToHost(nlIOGetUnaligned64(p));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 8-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPutUnaligned8(void *p, uint8_t v)
+{
+ nlIOPutUnaligned8(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 16-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPutUnaligned16(void *p, uint16_t v)
+{
+ nlIOPutUnaligned16(p, nlByteOrderSwap16HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 32-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPutUnaligned32(void *p, uint32_t v)
+{
+ nlIOPutUnaligned32(p, nlByteOrderSwap32HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 64-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianPutUnaligned64(void *p, uint64_t v)
+{
+ nlIOPutUnaligned64(p, nlByteOrderSwap64HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to read the 8-bit big endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOBigEndianReadUnaligned8(const void **p)
+{
+ return nlIOReadUnaligned8(p);
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to read the 16-bit big endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOBigEndianReadUnaligned16(const void **p)
+{
+ return nlByteOrderSwap16BigToHost(nlIOReadUnaligned16(p));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to read the 32-bit big endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOBigEndianReadUnaligned32(const void **p)
+{
+ return nlByteOrderSwap32BigToHost(nlIOReadUnaligned32(p));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to read the 64-bit big endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOBigEndianReadUnaligned64(const void **p)
+{
+ return nlByteOrderSwap64BigToHost(nlIOReadUnaligned64(p));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to write the target system byte
+ * ordered 8-bit value to in big endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWriteUnaligned8(void **p, uint8_t v)
+{
+ nlIOWriteUnaligned8(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to write the target system byte
+ * ordered 16-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWriteUnaligned16(void **p, uint16_t v)
+{
+ nlIOWriteUnaligned16(p, nlByteOrderSwap16HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to write the target system byte
+ * ordered 32-bit value to in big endian byte
+ * ordering and to then increment by 32-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWriteUnaligned32(void **p, uint32_t v)
+{
+ nlIOWriteUnaligned32(p, nlByteOrderSwap32HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to write the target system byte
+ * ordered 64-bit value to in big endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOBigEndianWriteUnaligned64(void **p, uint64_t v)
+{
+ nlIOWriteUnaligned64(p, nlByteOrderSwap64HostToBig(v));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NLIO_BYTEORDER_BIG_H */
diff --git a/include/nlio-byteorder-big.hpp b/include/nlio-byteorder-big.hpp
new file mode 100644
index 0000000..a34be83
--- /dev/null
+++ b/include/nlio-byteorder-big.hpp
@@ -0,0 +1,922 @@
+/**
+ * Copyright 2013-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines C++ functions for safely performing simple,
+ * memory-mapped accesses, potentially to unaligned, aligned, and
+ * unaligned memory locations with byte reordering, specifically
+ * for big endian target systems.
+ */
+
+#ifndef NLIO_BYTEORDER_BIG_HPP
+#define NLIO_BYTEORDER_BIG_HPP
+
+#include <nlio-base.hpp>
+#include <nlbyteorder.hpp>
+
+namespace nl
+{
+
+namespace IO
+{
+
+namespace BigEndian
+{
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 8-bit big endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t Get8(const void *p)
+{
+ return IO::Get8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 16-bit big endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t Get16(const void *p)
+{
+ return ByteOrder::Swap16BigToHost(IO::Get16(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 32-bit big endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t Get32(const void *p)
+{
+ return ByteOrder::Swap32BigToHost(IO::Get32(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 64-bit big endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t Get64(const void *p)
+{
+ return ByteOrder::Swap64BigToHost(IO::Get64(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 8-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void Put8(void *p, uint8_t v)
+{
+ IO::Put8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 16-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void Put16(void *p, uint16_t v)
+{
+ IO::Put16(p, ByteOrder::Swap16HostToBig(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 32-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void Put32(void *p, uint32_t v)
+{
+ IO::Put32(p, ByteOrder::Swap32HostToBig(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 64-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void Put64(void *p, uint64_t v)
+{
+ IO::Put64(p, ByteOrder::Swap64HostToBig(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 8-bit big endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t Read8(const void *&p)
+{
+ return IO::Read8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 16-bit big endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t Read16(const void *&p)
+{
+ return ByteOrder::Swap16BigToHost(IO::Read16(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 32-bit big endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t Read32(const void *&p)
+{
+ return ByteOrder::Swap32BigToHost(IO::Read32(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 64-bit big endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t Read64(const void *&p)
+{
+ return ByteOrder::Swap64BigToHost(IO::Read64(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A reference to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 8-bit value to in big endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void Write8(void *&p, uint8_t v)
+{
+ IO::Write8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A reference to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 16-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void Write16(void *&p, uint16_t v)
+{
+ IO::Write16(p, ByteOrder::Swap16HostToBig(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A reference to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 32-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void Write32(void *&p, uint32_t v)
+{
+ IO::Write32(p, ByteOrder::Swap32HostToBig(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p A reference to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 64-bit value to in big endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void Write64(void *&p, uint64_t v)
+{
+ IO::Write64(p, ByteOrder::Swap64HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 8-bit big endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t GetAligned8(const void *p)
+{
+ return IO::GetAligned8(p);
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 16-bit big endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t GetAligned16(const void *p)
+{
+ return ByteOrder::Swap16BigToHost(IO::GetAligned16(p));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 32-bit big endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t GetAligned32(const void *p)
+{
+ return ByteOrder::Swap32BigToHost(IO::GetAligned32(p));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 64-bit big endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t GetAligned64(const void *p)
+{
+ return ByteOrder::Swap64BigToHost(IO::GetAligned64(p));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 8-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void PutAligned8(void *p, uint8_t v)
+{
+ IO::PutAligned8(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 16-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void PutAligned16(void *p, uint16_t v)
+{
+ IO::PutAligned16(p, ByteOrder::Swap16HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 32-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void PutAligned32(void *p, uint32_t v)
+{
+ IO::PutAligned32(p, ByteOrder::Swap32HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 64-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void PutAligned64(void *p, uint64_t v)
+{
+ IO::PutAligned64(p, ByteOrder::Swap64HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to read the 8-bit big endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t ReadAligned8(const void *&p)
+{
+ return IO::ReadAligned8(p);
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to read the 16-bit big endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t ReadAligned16(const void *&p)
+{
+ return ByteOrder::Swap16BigToHost(IO::ReadAligned16(p));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to read the 32-bit big endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t ReadAligned32(const void *&p)
+{
+ return ByteOrder::Swap32BigToHost(IO::ReadAligned32(p));
+}
+
+/**
+ * Perform an aligned memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to read the 64-bit big endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t ReadAligned64(const void *&p)
+{
+ return ByteOrder::Swap64BigToHost(IO::ReadAligned64(p));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to write the target system byte
+ * ordered 8-bit value to in big endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void WriteAligned8(void *&p, uint8_t v)
+{
+ IO::WriteAligned8(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to write the target system byte
+ * ordered 16-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void WriteAligned16(void *&p, uint16_t v)
+{
+ IO::WriteAligned16(p, ByteOrder::Swap16HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to write the target system byte
+ * ordered 32-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void WriteAligned32(void *&p, uint32_t v)
+{
+ IO::WriteAligned32(p, ByteOrder::Swap32HostToBig(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to write the target system byte
+ * ordered 64-bit value to in big endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void WriteAligned64(void *&p, uint64_t v)
+{
+ IO::WriteAligned64(p, ByteOrder::Swap64HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 8-bit big endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t GetUnaligned8(const void *p)
+{
+ return IO::GetUnaligned8(p);
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 16-bit big endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t GetUnaligned16(const void *p)
+{
+ return ByteOrder::Swap16BigToHost(IO::GetUnaligned16(p));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 32-bit big endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t GetUnaligned32(const void *p)
+{
+ return ByteOrder::Swap32BigToHost(IO::GetUnaligned32(p));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 64-bit big endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t GetUnaligned64(const void *p)
+{
+ return ByteOrder::Swap64BigToHost(IO::GetUnaligned64(p));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 8-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void PutUnaligned8(void *p, uint8_t v)
+{
+ IO::PutUnaligned8(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 16-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void PutUnaligned16(void *p, uint16_t v)
+{
+ IO::PutUnaligned16(p, ByteOrder::Swap16HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 32-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void PutUnaligned32(void *p, uint32_t v)
+{
+ IO::PutUnaligned32(p, ByteOrder::Swap32HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 64-bit value to in big
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void PutUnaligned64(void *p, uint64_t v)
+{
+ IO::PutUnaligned64(p, ByteOrder::Swap64HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to read the 8-bit big endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t ReadUnaligned8(const void *&p)
+{
+ return IO::ReadUnaligned8(p);
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to read the 16-bit big endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t ReadUnaligned16(const void *&p)
+{
+ return ByteOrder::Swap16BigToHost(IO::ReadUnaligned16(p));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to read the 32-bit big endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t ReadUnaligned32(const void *&p)
+{
+ return ByteOrder::Swap32BigToHost(IO::ReadUnaligned32(p));
+}
+
+/**
+ * Perform an unaligned memory read of the big endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to read the 64-bit big endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t ReadUnaligned64(const void *&p)
+{
+ return ByteOrder::Swap64BigToHost(IO::ReadUnaligned64(p));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to write the target system byte
+ * ordered 8-bit value to in big endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void WriteUnaligned8(void *&p, uint8_t v)
+{
+ IO::WriteUnaligned8(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to write the target system byte
+ * ordered 16-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void WriteUnaligned16(void *&p, uint16_t v)
+{
+ IO::WriteUnaligned16(p, ByteOrder::Swap16HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to write the target system byte
+ * ordered 32-bit value to in big endian byte
+ * ordering and to then increment by 16-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void WriteUnaligned32(void *&p, uint32_t v)
+{
+ IO::WriteUnaligned32(p, ByteOrder::Swap32HostToBig(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in big endian byte ordering.
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to write the target system byte
+ * ordered 64-bit value to in big endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void WriteUnaligned64(void *&p, uint64_t v)
+{
+ IO::WriteUnaligned64(p, ByteOrder::Swap64HostToBig(v));
+}
+
+}; // namespace BigEndian
+
+}; // namespace IO
+
+}; // namespace nl
+
+#endif // NLIO_BYTEORDER_BIG_HPP
diff --git a/include/nlio-byteorder-little.h b/include/nlio-byteorder-little.h
new file mode 100644
index 0000000..06c477e
--- /dev/null
+++ b/include/nlio-byteorder-little.h
@@ -0,0 +1,915 @@
+/**
+ * Copyright 2013-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines C functions for safely performing simple,
+ * memory-mapped accesses, potentially to unaligned, aligned, and
+ * unaligned memory locations with byte reordering, specifically
+ * for little endian target systems.
+ */
+
+#ifndef NLIO_BYTEORDER_LITTLE_H
+#define NLIO_BYTEORDER_LITTLE_H
+
+#include <nlio-base.h>
+#include <nlbyteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 8-bit little endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOLittleEndianGet8(const void *p)
+{
+ return nlIOGet8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 16-bit little endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOLittleEndianGet16(const void *p)
+{
+ return nlByteOrderSwap16LittleToHost(nlIOGet16(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 32-bit little endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOLittleEndianGet32(const void *p)
+{
+ return nlByteOrderSwap32LittleToHost(nlIOGet32(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 64-bit little endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOLittleEndianGet64(const void *p)
+{
+ return nlByteOrderSwap64LittleToHost(nlIOGet64(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 8-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPut8(void *p, uint8_t v)
+{
+ nlIOPut8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 16-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPut16(void *p, uint16_t v)
+{
+ nlIOPut16(p, nlByteOrderSwap16HostToLittle(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 32-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPut32(void *p, uint32_t v)
+{
+ nlIOPut32(p, nlByteOrderSwap32HostToLittle(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 64-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPut64(void *p, uint64_t v)
+{
+ nlIOPut64(p, nlByteOrderSwap64HostToLittle(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 8-bit little endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOLittleEndianRead8(const void **p)
+{
+ return nlIORead8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 16-bit little endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOLittleEndianRead16(const void **p)
+{
+ return nlByteOrderSwap16LittleToHost(nlIORead16(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 32-bit little endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOLittleEndianRead32(const void **p)
+{
+ return nlByteOrderSwap32LittleToHost(nlIORead32(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to a pointer address, potentially
+ * unaligned, to read the 64-bit little endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOLittleEndianRead64(const void **p)
+{
+ return nlByteOrderSwap64LittleToHost(nlIORead64(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 8-bit value to in little endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWrite8(void **p, uint8_t v)
+{
+ nlIOWrite8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 16-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWrite16(void **p, uint16_t v)
+{
+ nlIOWrite16(p, nlByteOrderSwap16HostToLittle(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 32-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWrite32(void **p, uint32_t v)
+{
+ nlIOWrite32(p, nlByteOrderSwap32HostToLittle(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 64-bit value to in little endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWrite64(void **p, uint64_t v)
+{
+ nlIOWrite64(p, nlByteOrderSwap64HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 8-bit little endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOLittleEndianGetAligned8(const void *p)
+{
+ return nlIOGetAligned8(p);
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 16-bit little endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOLittleEndianGetAligned16(const void *p)
+{
+ return nlByteOrderSwap16LittleToHost(nlIOGetAligned16(p));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 32-bit little endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOLittleEndianGetAligned32(const void *p)
+{
+ return nlByteOrderSwap32LittleToHost(nlIOGetAligned32(p));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 64-bit little endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOLittleEndianGetAligned64(const void *p)
+{
+ return nlByteOrderSwap64LittleToHost(nlIOGetAligned64(p));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 8-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPutAligned8(void *p, uint8_t v)
+{
+ nlIOPutAligned8(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 16-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPutAligned16(void *p, uint16_t v)
+{
+ nlIOPutAligned16(p, nlByteOrderSwap16HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 32-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPutAligned32(void *p, uint32_t v)
+{
+ nlIOPutAligned32(p, nlByteOrderSwap32HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 64-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPutAligned64(void *p, uint64_t v)
+{
+ nlIOPutAligned64(p, nlByteOrderSwap64HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to read the 8-bit little endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOLittleEndianReadAligned8(const void **p)
+{
+ return nlIOReadAligned8(p);
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to read the 16-bit little endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOLittleEndianReadAligned16(const void **p)
+{
+ return nlByteOrderSwap16LittleToHost(nlIOReadAligned16(p));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to read the 32-bit little endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOLittleEndianReadAligned32(const void **p)
+{
+ return nlByteOrderSwap32LittleToHost(nlIOReadAligned32(p));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to read the 64-bit little endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOLittleEndianReadAligned64(const void **p)
+{
+ return nlByteOrderSwap64LittleToHost(nlIOReadAligned64(p));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to write the target system byte
+ * ordered 8-bit value to in little endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWriteAligned8(void **p, uint8_t v)
+{
+ nlIOWriteAligned8(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to write the target system byte
+ * ordered 16-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWriteAligned16(void **p, uint16_t v)
+{
+ nlIOWriteAligned16(p, nlByteOrderSwap16HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to write the target system byte
+ * ordered 32-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWriteAligned32(void **p, uint32_t v)
+{
+ nlIOWriteAligned32(p, nlByteOrderSwap32HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A pointer to an aligned pointer address,
+ * to write the target system byte
+ * ordered 64-bit value to in little endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWriteAligned64(void **p, uint64_t v)
+{
+ nlIOWriteAligned64(p, nlByteOrderSwap64HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 8-bit little endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOLittleEndianGetUnaligned8(const void *p)
+{
+ return nlIOGetUnaligned8(p);
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 16-bit little endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOLittleEndianGetUnaligned16(const void *p)
+{
+ return nlByteOrderSwap16LittleToHost(nlIOGetUnaligned16(p));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 32-bit little endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOLittleEndianGetUnaligned32(const void *p)
+{
+ return nlByteOrderSwap32LittleToHost(nlIOGetUnaligned32(p));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 64-bit little endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOLittleEndianGetUnaligned64(const void *p)
+{
+ return nlByteOrderSwap64LittleToHost(nlIOGetUnaligned64(p));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 8-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPutUnaligned8(void *p, uint8_t v)
+{
+ nlIOPutUnaligned8(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 16-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPutUnaligned16(void *p, uint16_t v)
+{
+ nlIOPutUnaligned16(p, nlByteOrderSwap16HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 32-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPutUnaligned32(void *p, uint32_t v)
+{
+ nlIOPutUnaligned32(p, nlByteOrderSwap32HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 64-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianPutUnaligned64(void *p, uint64_t v)
+{
+ nlIOPutUnaligned64(p, nlByteOrderSwap64HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to read the 8-bit little endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t nlIOLittleEndianReadUnaligned8(const void **p)
+{
+ return nlIOReadUnaligned8(p);
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to read the 16-bit little endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t nlIOLittleEndianReadUnaligned16(const void **p)
+{
+ return nlByteOrderSwap16LittleToHost(nlIOReadUnaligned16(p));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to read the 32-bit little endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t nlIOLittleEndianReadUnaligned32(const void **p)
+{
+ return nlByteOrderSwap32LittleToHost(nlIOReadUnaligned32(p));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to read the 64-bit little endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t nlIOLittleEndianReadUnaligned64(const void **p)
+{
+ return nlByteOrderSwap64LittleToHost(nlIOReadUnaligned64(p));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to write the target system byte
+ * ordered 8-bit value to in little endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWriteUnaligned8(void **p, uint8_t v)
+{
+ nlIOWriteUnaligned8(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to write the target system byte
+ * ordered 16-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWriteUnaligned16(void **p, uint16_t v)
+{
+ nlIOWriteUnaligned16(p, nlByteOrderSwap16HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to write the target system byte
+ * ordered 32-bit value to in little endian byte
+ * ordering and to then increment by 32-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWriteUnaligned32(void **p, uint32_t v)
+{
+ nlIOWriteUnaligned32(p, nlByteOrderSwap32HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A pointer to an unaligined pointer address,
+ * to write the target system byte
+ * ordered 64-bit value to in little endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void nlIOLittleEndianWriteUnaligned64(void **p, uint64_t v)
+{
+ nlIOWriteUnaligned64(p, nlByteOrderSwap64HostToLittle(v));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NLIO_BYTEORDER_LITTLE_H */
diff --git a/include/nlio-byteorder-little.hpp b/include/nlio-byteorder-little.hpp
new file mode 100644
index 0000000..7c3ec2e
--- /dev/null
+++ b/include/nlio-byteorder-little.hpp
@@ -0,0 +1,922 @@
+/**
+ * Copyright 2013-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines C++ functions for safely performing simple,
+ * memory-mapped accesses, potentially to unaligned, aligned, and
+ * unaligned memory locations with byte reordering, specifically
+ * for little endian target systems.
+ */
+
+#ifndef NLIO_BYTEORDER_LITTLE_HPP
+#define NLIO_BYTEORDER_LITTLE_HPP
+
+#include <nlio-base.hpp>
+#include <nlbyteorder.hpp>
+
+namespace nl
+{
+
+namespace IO
+{
+
+namespace LittleEndian
+{
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 8-bit little endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t Get8(const void *p)
+{
+ return IO::Get8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 16-bit little endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t Get16(const void *p)
+{
+ return ByteOrder::Swap16LittleToHost(IO::Get16(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 32-bit little endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t Get32(const void *p)
+{
+ return ByteOrder::Swap32LittleToHost(IO::Get32(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to read
+ * the 64-bit little endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t Get64(const void *p)
+{
+ return ByteOrder::Swap64LittleToHost(IO::Get64(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 8-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void Put8(void *p, uint8_t v)
+{
+ IO::Put8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 16-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void Put16(void *p, uint16_t v)
+{
+ IO::Put16(p, ByteOrder::Swap16HostToLittle(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 32-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void Put32(void *p, uint32_t v)
+{
+ IO::Put32(p, ByteOrder::Swap32HostToLittle(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A pointer address, potentially unaligned, to write
+ * the target system byte ordered 64-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void Put64(void *p, uint64_t v)
+{
+ IO::Put64(p, ByteOrder::Swap64HostToLittle(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 8-bit little endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t Read8(const void *&p)
+{
+ return IO::Read8(p);
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 16-bit little endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t Read16(const void *&p)
+{
+ return ByteOrder::Swap16LittleToHost(IO::Read16(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 32-bit little endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t Read32(const void *&p)
+{
+ return ByteOrder::Swap32LittleToHost(IO::Read32(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to a pointer address, potentially
+ * unaligned, to read the 64-bit little endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t Read64(const void *&p)
+{
+ return ByteOrder::Swap64LittleToHost(IO::Read64(p));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A reference to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 8-bit value to in little endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void Write8(void *&p, uint8_t v)
+{
+ IO::Write8(p, v);
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A reference to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 16-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void Write16(void *&p, uint16_t v)
+{
+ IO::Write16(p, ByteOrder::Swap16HostToLittle(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A reference to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 32-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void Write32(void *&p, uint32_t v)
+{
+ IO::Write32(p, ByteOrder::Swap32HostToLittle(v));
+}
+
+/**
+ * Perform a, potentially unaligned, memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p A reference to a pointer address, potentially
+ * unaligned, to write the target system byte
+ * ordered 64-bit value to in little endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void Write64(void *&p, uint64_t v)
+{
+ IO::Write64(p, ByteOrder::Swap64HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 8-bit little endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t GetAligned8(const void *p)
+{
+ return IO::GetAligned8(p);
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 16-bit little endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t GetAligned16(const void *p)
+{
+ return ByteOrder::Swap16LittleToHost(IO::GetAligned16(p));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 32-bit little endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t GetAligned32(const void *p)
+{
+ return ByteOrder::Swap32LittleToHost(IO::GetAligned32(p));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An aligned pointer address to read
+ * the 64-bit little endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t GetAligned64(const void *p)
+{
+ return ByteOrder::Swap64LittleToHost(IO::GetAligned64(p));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 8-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void PutAligned8(void *p, uint8_t v)
+{
+ IO::PutAligned8(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 16-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void PutAligned16(void *p, uint16_t v)
+{
+ IO::PutAligned16(p, ByteOrder::Swap16HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 32-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void PutAligned32(void *p, uint32_t v)
+{
+ IO::PutAligned32(p, ByteOrder::Swap32HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An aligned pointer address to write
+ * the target system byte ordered 64-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void PutAligned64(void *p, uint64_t v)
+{
+ IO::PutAligned64(p, ByteOrder::Swap64HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to read the 8-bit little endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t ReadAligned8(const void *&p)
+{
+ return IO::ReadAligned8(p);
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to read the 16-bit little endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t ReadAligned16(const void *&p)
+{
+ return ByteOrder::Swap16LittleToHost(IO::ReadAligned16(p));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to read the 32-bit little endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t ReadAligned32(const void *&p)
+{
+ return ByteOrder::Swap32LittleToHost(IO::ReadAligned32(p));
+}
+
+/**
+ * Perform an aligned memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to read the 64-bit little endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t ReadAligned64(const void *&p)
+{
+ return ByteOrder::Swap64LittleToHost(IO::ReadAligned64(p));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to write the target system byte
+ * ordered 8-bit value to in little endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void WriteAligned8(void *&p, uint8_t v)
+{
+ IO::WriteAligned8(p, v);
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to write the target system byte
+ * ordered 16-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void WriteAligned16(void *&p, uint16_t v)
+{
+ IO::WriteAligned16(p, ByteOrder::Swap16HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to write the target system byte
+ * ordered 32-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void WriteAligned32(void *&p, uint32_t v)
+{
+ IO::WriteAligned32(p, ByteOrder::Swap32HostToLittle(v));
+}
+
+/**
+ * Perform an aligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A reference to an aligned pointer address
+ * to write the target system byte
+ * ordered 64-bit value to in little endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void WriteAligned64(void *&p, uint64_t v)
+{
+ IO::WriteAligned64(p, ByteOrder::Swap64HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 8-bit little endian byte ordered value from.
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t GetUnaligned8(const void *p)
+{
+ return IO::GetUnaligned8(p);
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 16-bit little endian byte ordered value from.
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t GetUnaligned16(const void *p)
+{
+ return ByteOrder::Swap16LittleToHost(IO::GetUnaligned16(p));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 32-bit little endian byte ordered value from.
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t GetUnaligned32(const void *p)
+{
+ return ByteOrder::Swap32LittleToHost(IO::GetUnaligned32(p));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in target system byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to read
+ * the 64-bit little endian byte ordered value from.
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t GetUnaligned64(const void *p)
+{
+ return ByteOrder::Swap64LittleToHost(IO::GetUnaligned64(p));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 8-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void PutUnaligned8(void *p, uint8_t v)
+{
+ IO::PutUnaligned8(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 16-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void PutUnaligned16(void *p, uint16_t v)
+{
+ IO::PutUnaligned16(p, ByteOrder::Swap16HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 32-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void PutUnaligned32(void *p, uint32_t v)
+{
+ IO::PutUnaligned32(p, ByteOrder::Swap32HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[in] p An unaligned pointer address to write
+ * the target system byte ordered 64-bit value to in little
+ * endian byte ordering.
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void PutUnaligned64(void *p, uint64_t v)
+{
+ IO::PutUnaligned64(p, ByteOrder::Swap64HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 8-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 8-bits (1 byte).
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to read the 8-bit little endian byte
+ * ordered value from and to then increment by 8-
+ * bits (1 byte).
+ *
+ * @return The 8-bit value at the specified pointer address.
+ */
+static inline uint8_t ReadUnaligned8(const void *&p)
+{
+ return IO::ReadUnaligned8(p);
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 16-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 16-bits (2 bytes).
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to read the 16-bit little endian byte
+ * ordered value from and to then increment by 16-
+ * bits (2 bytes).
+ *
+ * @return The 16-bit value at the specified pointer address.
+ */
+static inline uint16_t ReadUnaligned16(const void *&p)
+{
+ return ByteOrder::Swap16LittleToHost(IO::ReadUnaligned16(p));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 32-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 32-bits (4 bytes).
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to read the 32-bit little endian byte
+ * ordered value from and to then increment by 32-
+ * bits (4 bytes).
+ *
+ * @return The 32-bit value at the specified pointer address.
+ */
+static inline uint32_t ReadUnaligned32(const void *&p)
+{
+ return ByteOrder::Swap32LittleToHost(IO::ReadUnaligned32(p));
+}
+
+/**
+ * Perform an unaligned memory read of the little endian
+ * byte ordered 64-bit value from the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to put
+ * the value in target system byte ordering, and increment the pointer
+ * by 64-bits (8 bytes).
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to read the 64-bit little endian byte
+ * ordered value from and to then increment by 64-
+ * bits (8 bytes).
+ *
+ * @return The 64-bit value at the specified pointer address.
+ */
+static inline uint64_t ReadUnaligned64(const void *&p)
+{
+ return ByteOrder::Swap64LittleToHost(IO::ReadUnaligned64(p));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 8-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to write the target system byte
+ * ordered 8-bit value to in little endian byte
+ * ordering and to then increment by 8-bits (1
+ * byte).
+ *
+ * @param[in] v The 8-bit value to write.
+ *
+ */
+static inline void WriteUnaligned8(void *&p, uint8_t v)
+{
+ IO::WriteUnaligned8(p, v);
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 16-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to write the target system byte
+ * ordered 16-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (2
+ * bytes).
+ *
+ * @param[in] v The 16-bit value to write.
+ *
+ */
+static inline void WriteUnaligned16(void *&p, uint16_t v)
+{
+ IO::WriteUnaligned16(p, ByteOrder::Swap16HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 32-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to write the target system byte
+ * ordered 32-bit value to in little endian byte
+ * ordering and to then increment by 16-bits (4
+ * bytes).
+ *
+ * @param[in] v The 32-bit value to write.
+ *
+ */
+static inline void WriteUnaligned32(void *&p, uint32_t v)
+{
+ IO::WriteUnaligned32(p, ByteOrder::Swap32HostToLittle(v));
+}
+
+/**
+ * Perform an unaligned memory write of the target system
+ * byte ordered 64-bit value to the specified pointer address,
+ * perform byte reordering, as necessary, for the target system to
+ * put the value in little endian byte ordering.
+ *
+ * @param[inout] p A reference to an unaligned pointer address
+ * to write the target system byte
+ * ordered 64-bit value to in little endian byte
+ * ordering and to then increment by 64-bits (8
+ * bytes).
+ *
+ * @param[in] v The 64-bit value to write.
+ *
+ */
+static inline void WriteUnaligned64(void *&p, uint64_t v)
+{
+ IO::WriteUnaligned64(p, ByteOrder::Swap64HostToLittle(v));
+}
+
+}; // namespace LittleEndian
+
+}; // namespace IO
+
+}; // namespace nl
+
+#endif // NLIO_BYTEORDER_LITTLE_HPP
diff --git a/include/nlio-byteorder.h b/include/nlio-byteorder.h
new file mode 100644
index 0000000..9e67001
--- /dev/null
+++ b/include/nlio-byteorder.h
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2013-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines C functions for safely performing simple,
+ * memory-mapped accesses, potentially to unaligned memory
+ * locations with byte reordering.
+ */
+
+#ifndef NLIO_BYTEORDER_H
+#define NLIO_BYTEORDER_H
+
+#include <nlio-base.h>
+#include <nlbyteorder.h>
+
+#include <nlio-byteorder-big.h>
+#include <nlio-byteorder-little.h>
+
+#endif /* NLIO_BYTEORDER_H */
diff --git a/include/nlio-byteorder.hpp b/include/nlio-byteorder.hpp
new file mode 100644
index 0000000..e44256b
--- /dev/null
+++ b/include/nlio-byteorder.hpp
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2013-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines C++ functions for safely performing simple,
+ * memory-mapped accesses, potentially to unaligned memory
+ * locations with byte reordering.
+ */
+
+#ifndef NLIO_BYTEORDER_HPP
+#define NLIO_BYTEORDER_HPP
+
+#include <nlio-base.hpp>
+#include <nlbyteorder.hpp>
+
+#include <nlio-byteorder-big.hpp>
+#include <nlio-byteorder-little.hpp>
+
+#endif // NLIO_BYTEORDER_HPP
diff --git a/include/nlio-config.h.in b/include/nlio-config.h.in
new file mode 100644
index 0000000..06cf758
--- /dev/null
+++ b/include/nlio-config.h.in
@@ -0,0 +1,133 @@
+/* include/nlio-config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if your C++ compiler doesn't accept -c and -o together. */
+#undef CXX_NO_MINUS_C_MINUS_O
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <endian.h> header file. */
+#undef HAVE_ENDIAN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <machine/endian.h> header file. */
+#undef HAVE_MACHINE_ENDIAN_H
+
+/* Define to 1 if you have the `memcpy' function. */
+#undef HAVE_MEMCPY
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <nlunit-test.h> header file. */
+#undef HAVE_NLUNIT_TEST_H
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT64_T
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT8_T
+
+/* Define to the type of a signed integer type of width exactly 16 bits if
+ such a type exists and the standard includes do not define it. */
+#undef int16_t
+
+/* Define to the type of a signed integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+#undef int32_t
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+#undef int64_t
+
+/* Define to the type of a signed integer type of width exactly 8 bits if such
+ a type exists and the standard includes do not define it. */
+#undef int8_t
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint16_t
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint64_t
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint8_t
diff --git a/include/nlio-private.h b/include/nlio-private.h
new file mode 100644
index 0000000..22dc4d0
--- /dev/null
+++ b/include/nlio-private.h
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2017 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines private macros and interfaces.
+ */
+
+#ifndef NLIO_PRIVATE_H
+#define NLIO_PRIVATE_H
+
+/*
+ * If we are compiling under clang, GCC, or any such compatible
+ * compiler, in which -fno-builtins or -ffreestanding might be
+ * asserted, thereby eliminating built-in function optimization, we
+ * may STILL want to leverage built-ins.
+ *
+ * Provide an internal convenience macro to do so.
+ */
+
+/**
+ * @def __nlIOHasBuiltin
+ *
+ * @brief
+ * Determines whether or not the compiler in effect has support
+ * for the specified built-in function.
+ *
+ */
+#ifdef __clang__
+#define __nlIOHasBuiltin(...) __has_builtin(__VA_ARGS__)
+#elif defined __GNUC__
+#define __nlIOHasBuiltin(...) 1
+#else
+#define __nlIOHasBuiltin(...) 0
+#endif /* __clang__ */
+
+#endif /* NLIO_PRIVATE_H */
diff --git a/include/nlio.h b/include/nlio.h
new file mode 100644
index 0000000..b706826
--- /dev/null
+++ b/include/nlio.h
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2013-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file is an umbrella header for the C language definitions
+ * of functions for safely performing simple, memory-mapped
+ * accesses, potentially to unaligned memory locations, with or
+ * without byte reordering.
+ */
+
+#ifndef NLIO_H
+#define NLIO_H
+
+#include <nlio-base.h>
+#include <nlio-byteorder.h>
+
+#endif /* NLIO_H */
+
+
+
+
+
+
+
diff --git a/include/nlio.hpp b/include/nlio.hpp
new file mode 100644
index 0000000..47487f3
--- /dev/null
+++ b/include/nlio.hpp
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2013-2016 Nest Labs Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file is an umbrella header for the C++ language
+ * definitions of functions for safely performing simple,
+ * memory-mapped accesses, potentially to unaligned memory
+ * locations, with or without byte reordering.
+ */
+
+#ifndef NLIO_HPP
+#define NLIO_HPP
+
+#include <nlio-base.hpp>
+#include <nlio-byteorder.hpp>
+
+#endif // NLIO_HPP
+
+
+
+
+
+
+