2 * Copyright 2013-2016 Nest Labs Inc. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 * This file defines C++ functions for safely performing simple,
20 * memory-mapped accesses, potentially to unaligned, aligned, and
21 * unaligned memory locations with byte reordering, specifically
22 * for big endian target systems.
25 #ifndef NLIO_BYTEORDER_BIG_HPP
26 #define NLIO_BYTEORDER_BIG_HPP
28 #include <nlio-base.hpp>
29 #include <nlbyteorder.hpp>
41 * Perform a, potentially unaligned, memory read of the big endian
42 * byte ordered 8-bit value from the specified pointer address,
43 * perform byte reordering, as necessary, for the target system to
44 * put the value in target system byte ordering.
46 * @param[in] p A pointer address, potentially unaligned, to read
47 * the 8-bit big endian byte ordered value from.
49 * @return The 8-bit value at the specified pointer address.
51 static inline uint8_t Get8(const void *p)
57 * Perform a, potentially unaligned, memory read of the big endian
58 * byte ordered 16-bit value from the specified pointer address,
59 * perform byte reordering, as necessary, for the target system to
60 * put the value in target system byte ordering.
62 * @param[in] p A pointer address, potentially unaligned, to read
63 * the 16-bit big endian byte ordered value from.
65 * @return The 16-bit value at the specified pointer address.
67 static inline uint16_t Get16(const void *p)
69 return ByteOrder::Swap16BigToHost(IO::Get16(p));
73 * Perform a, potentially unaligned, memory read of the big endian
74 * byte ordered 32-bit value from the specified pointer address,
75 * perform byte reordering, as necessary, for the target system to
76 * put the value in target system byte ordering.
78 * @param[in] p A pointer address, potentially unaligned, to read
79 * the 32-bit big endian byte ordered value from.
81 * @return The 32-bit value at the specified pointer address.
83 static inline uint32_t Get32(const void *p)
85 return ByteOrder::Swap32BigToHost(IO::Get32(p));
89 * Perform a, potentially unaligned, memory read of the big endian
90 * byte ordered 64-bit value from the specified pointer address,
91 * perform byte reordering, as necessary, for the target system to
92 * put the value in target system byte ordering.
94 * @param[in] p A pointer address, potentially unaligned, to read
95 * the 64-bit big endian byte ordered value from.
97 * @return The 64-bit value at the specified pointer address.
99 static inline uint64_t Get64(const void *p)
101 return ByteOrder::Swap64BigToHost(IO::Get64(p));
105 * Perform a, potentially unaligned, memory write of the target system
106 * byte ordered 8-bit value to the specified pointer address,
107 * perform byte reordering, as necessary, for the target system to
108 * put the value in big endian byte ordering.
110 * @param[in] p A pointer address, potentially unaligned, to write
111 * the target system byte ordered 8-bit value to in big
112 * endian byte ordering.
114 * @param[in] v The 8-bit value to write.
117 static inline void Put8(void *p, uint8_t v)
123 * Perform a, potentially unaligned, memory write of the target system
124 * byte ordered 16-bit value to the specified pointer address,
125 * perform byte reordering, as necessary, for the target system to
126 * put the value in big endian byte ordering.
128 * @param[in] p A pointer address, potentially unaligned, to write
129 * the target system byte ordered 16-bit value to in big
130 * endian byte ordering.
132 * @param[in] v The 16-bit value to write.
135 static inline void Put16(void *p, uint16_t v)
137 IO::Put16(p, ByteOrder::Swap16HostToBig(v));
141 * Perform a, potentially unaligned, memory write of the target system
142 * byte ordered 32-bit value to the specified pointer address,
143 * perform byte reordering, as necessary, for the target system to
144 * put the value in big endian byte ordering.
146 * @param[in] p A pointer address, potentially unaligned, to write
147 * the target system byte ordered 32-bit value to in big
148 * endian byte ordering.
150 * @param[in] v The 32-bit value to write.
153 static inline void Put32(void *p, uint32_t v)
155 IO::Put32(p, ByteOrder::Swap32HostToBig(v));
159 * Perform a, potentially unaligned, memory write of the target system
160 * byte ordered 64-bit value to the specified pointer address,
161 * perform byte reordering, as necessary, for the target system to
162 * put the value in big endian byte ordering.
164 * @param[in] p A pointer address, potentially unaligned, to write
165 * the target system byte ordered 64-bit value to in big
166 * endian byte ordering.
168 * @param[in] v The 64-bit value to write.
171 static inline void Put64(void *p, uint64_t v)
173 IO::Put64(p, ByteOrder::Swap64HostToBig(v));
177 * Perform a, potentially unaligned, memory read of the big endian
178 * byte ordered 8-bit value from the specified pointer address,
179 * perform byte reordering, as necessary, for the target system to put
180 * the value in target system byte ordering, and increment the pointer
181 * by 8-bits (1 byte).
183 * @param[inout] p A reference to a pointer address, potentially
184 * unaligned, to read the 8-bit big endian byte
185 * ordered value from and to then increment by 8-
188 * @return The 8-bit value at the specified pointer address.
190 static inline uint8_t Read8(const void *&p)
196 * Perform a, potentially unaligned, memory read of the big endian
197 * byte ordered 16-bit value from the specified pointer address,
198 * perform byte reordering, as necessary, for the target system to put
199 * the value in target system byte ordering, and increment the pointer
200 * by 16-bits (2 bytes).
202 * @param[inout] p A reference to a pointer address, potentially
203 * unaligned, to read the 16-bit big endian byte
204 * ordered value from and to then increment by 16-
207 * @return The 16-bit value at the specified pointer address.
209 static inline uint16_t Read16(const void *&p)
211 return ByteOrder::Swap16BigToHost(IO::Read16(p));
215 * Perform a, potentially unaligned, memory read of the big endian
216 * byte ordered 32-bit value from the specified pointer address,
217 * perform byte reordering, as necessary, for the target system to put
218 * the value in target system byte ordering, and increment the pointer
219 * by 32-bits (4 bytes).
221 * @param[inout] p A reference to a pointer address, potentially
222 * unaligned, to read the 32-bit big endian byte
223 * ordered value from and to then increment by 32-
226 * @return The 32-bit value at the specified pointer address.
228 static inline uint32_t Read32(const void *&p)
230 return ByteOrder::Swap32BigToHost(IO::Read32(p));
234 * Perform a, potentially unaligned, memory read of the big endian
235 * byte ordered 64-bit value from the specified pointer address,
236 * perform byte reordering, as necessary, for the target system to put
237 * the value in target system byte ordering, and increment the pointer
238 * by 64-bits (8 bytes).
240 * @param[inout] p A reference to a pointer address, potentially
241 * unaligned, to read the 64-bit big endian byte
242 * ordered value from and to then increment by 64-
245 * @return The 64-bit value at the specified pointer address.
247 static inline uint64_t Read64(const void *&p)
249 return ByteOrder::Swap64BigToHost(IO::Read64(p));
253 * Perform a, potentially unaligned, memory write of the target system
254 * byte ordered 8-bit value to the specified pointer address,
255 * perform byte reordering, as necessary, for the target system to
256 * put the value in big endian byte ordering.
258 * @param[in] p A reference to a pointer address, potentially
259 * unaligned, to write the target system byte
260 * ordered 8-bit value to in big endian byte
261 * ordering and to then increment by 8-bits (1
264 * @param[in] v The 8-bit value to write.
267 static inline void Write8(void *&p, uint8_t v)
273 * Perform a, potentially unaligned, memory write of the target system
274 * byte ordered 16-bit value to the specified pointer address,
275 * perform byte reordering, as necessary, for the target system to
276 * put the value in big endian byte ordering.
278 * @param[in] p A reference to a pointer address, potentially
279 * unaligned, to write the target system byte
280 * ordered 16-bit value to in big endian byte
281 * ordering and to then increment by 16-bits (2
284 * @param[in] v The 16-bit value to write.
287 static inline void Write16(void *&p, uint16_t v)
289 IO::Write16(p, ByteOrder::Swap16HostToBig(v));
293 * Perform a, potentially unaligned, memory write of the target system
294 * byte ordered 32-bit value to the specified pointer address,
295 * perform byte reordering, as necessary, for the target system to
296 * put the value in big endian byte ordering.
298 * @param[in] p A reference to a pointer address, potentially
299 * unaligned, to write the target system byte
300 * ordered 32-bit value to in big endian byte
301 * ordering and to then increment by 16-bits (4
304 * @param[in] v The 32-bit value to write.
307 static inline void Write32(void *&p, uint32_t v)
309 IO::Write32(p, ByteOrder::Swap32HostToBig(v));
313 * Perform a, potentially unaligned, memory write of the target system
314 * byte ordered 64-bit value to the specified pointer address,
315 * perform byte reordering, as necessary, for the target system to
316 * put the value in big endian byte ordering.
318 * @param[in] p A reference to a pointer address, potentially
319 * unaligned, to write the target system byte
320 * ordered 64-bit value to in big endian byte
321 * ordering and to then increment by 64-bits (8
324 * @param[in] v The 64-bit value to write.
327 static inline void Write64(void *&p, uint64_t v)
329 IO::Write64(p, ByteOrder::Swap64HostToBig(v));
333 * Perform an aligned memory read of the big endian
334 * byte ordered 8-bit value from the specified pointer address,
335 * perform byte reordering, as necessary, for the target system to
336 * put the value in target system byte ordering.
338 * @param[in] p An aligned pointer address to read
339 * the 8-bit big endian byte ordered value from.
341 * @return The 8-bit value at the specified pointer address.
343 static inline uint8_t GetAligned8(const void *p)
345 return IO::GetAligned8(p);
349 * Perform an aligned memory read of the big endian
350 * byte ordered 16-bit value from the specified pointer address,
351 * perform byte reordering, as necessary, for the target system to
352 * put the value in target system byte ordering.
354 * @param[in] p An aligned pointer address to read
355 * the 16-bit big endian byte ordered value from.
357 * @return The 16-bit value at the specified pointer address.
359 static inline uint16_t GetAligned16(const void *p)
361 return ByteOrder::Swap16BigToHost(IO::GetAligned16(p));
365 * Perform an aligned memory read of the big endian
366 * byte ordered 32-bit value from the specified pointer address,
367 * perform byte reordering, as necessary, for the target system to
368 * put the value in target system byte ordering.
370 * @param[in] p An aligned pointer address to read
371 * the 32-bit big endian byte ordered value from.
373 * @return The 32-bit value at the specified pointer address.
375 static inline uint32_t GetAligned32(const void *p)
377 return ByteOrder::Swap32BigToHost(IO::GetAligned32(p));
381 * Perform an aligned memory read of the big endian
382 * byte ordered 64-bit value from the specified pointer address,
383 * perform byte reordering, as necessary, for the target system to
384 * put the value in target system byte ordering.
386 * @param[in] p An aligned pointer address to read
387 * the 64-bit big endian byte ordered value from.
389 * @return The 64-bit value at the specified pointer address.
391 static inline uint64_t GetAligned64(const void *p)
393 return ByteOrder::Swap64BigToHost(IO::GetAligned64(p));
397 * Perform an aligned memory write of the target system
398 * byte ordered 8-bit value to the specified pointer address,
399 * perform byte reordering, as necessary, for the target system to
400 * put the value in big endian byte ordering.
402 * @param[in] p An aligned pointer address to write
403 * the target system byte ordered 8-bit value to in big
404 * endian byte ordering.
406 * @param[in] v The 8-bit value to write.
409 static inline void PutAligned8(void *p, uint8_t v)
411 IO::PutAligned8(p, v);
415 * Perform an aligned memory write of the target system
416 * byte ordered 16-bit value to the specified pointer address,
417 * perform byte reordering, as necessary, for the target system to
418 * put the value in big endian byte ordering.
420 * @param[in] p An aligned pointer address to write
421 * the target system byte ordered 16-bit value to in big
422 * endian byte ordering.
424 * @param[in] v The 16-bit value to write.
427 static inline void PutAligned16(void *p, uint16_t v)
429 IO::PutAligned16(p, ByteOrder::Swap16HostToBig(v));
433 * Perform an aligned memory write of the target system
434 * byte ordered 32-bit value to the specified pointer address,
435 * perform byte reordering, as necessary, for the target system to
436 * put the value in big endian byte ordering.
438 * @param[in] p An aligned pointer address to write
439 * the target system byte ordered 32-bit value to in big
440 * endian byte ordering.
442 * @param[in] v The 32-bit value to write.
445 static inline void PutAligned32(void *p, uint32_t v)
447 IO::PutAligned32(p, ByteOrder::Swap32HostToBig(v));
451 * Perform an aligned memory write of the target system
452 * byte ordered 64-bit value to the specified pointer address,
453 * perform byte reordering, as necessary, for the target system to
454 * put the value in big endian byte ordering.
456 * @param[in] p An aligned pointer address to write
457 * the target system byte ordered 64-bit value to in big
458 * endian byte ordering.
460 * @param[in] v The 64-bit value to write.
463 static inline void PutAligned64(void *p, uint64_t v)
465 IO::PutAligned64(p, ByteOrder::Swap64HostToBig(v));
469 * Perform an aligned memory read of the big endian
470 * byte ordered 8-bit value from the specified pointer address,
471 * perform byte reordering, as necessary, for the target system to put
472 * the value in target system byte ordering, and increment the pointer
473 * by 8-bits (1 byte).
475 * @param[inout] p A reference to an aligned pointer address
476 * to read the 8-bit big endian byte
477 * ordered value from and to then increment by 8-
480 * @return The 8-bit value at the specified pointer address.
482 static inline uint8_t ReadAligned8(const void *&p)
484 return IO::ReadAligned8(p);
488 * Perform an aligned memory read of the big endian
489 * byte ordered 16-bit value from the specified pointer address,
490 * perform byte reordering, as necessary, for the target system to put
491 * the value in target system byte ordering, and increment the pointer
492 * by 16-bits (2 bytes).
494 * @param[inout] p A reference to an aligned pointer address
495 * to read the 16-bit big endian byte
496 * ordered value from and to then increment by 16-
499 * @return The 16-bit value at the specified pointer address.
501 static inline uint16_t ReadAligned16(const void *&p)
503 return ByteOrder::Swap16BigToHost(IO::ReadAligned16(p));
507 * Perform an aligned memory read of the big endian
508 * byte ordered 32-bit value from the specified pointer address,
509 * perform byte reordering, as necessary, for the target system to put
510 * the value in target system byte ordering, and increment the pointer
511 * by 32-bits (4 bytes).
513 * @param[inout] p A reference to an aligned pointer address
514 * to read the 32-bit big endian byte
515 * ordered value from and to then increment by 32-
518 * @return The 32-bit value at the specified pointer address.
520 static inline uint32_t ReadAligned32(const void *&p)
522 return ByteOrder::Swap32BigToHost(IO::ReadAligned32(p));
526 * Perform an aligned memory read of the big endian
527 * byte ordered 64-bit value from the specified pointer address,
528 * perform byte reordering, as necessary, for the target system to put
529 * the value in target system byte ordering, and increment the pointer
530 * by 64-bits (8 bytes).
532 * @param[inout] p A reference to an aligned pointer address
533 * to read the 64-bit big endian byte
534 * ordered value from and to then increment by 64-
537 * @return The 64-bit value at the specified pointer address.
539 static inline uint64_t ReadAligned64(const void *&p)
541 return ByteOrder::Swap64BigToHost(IO::ReadAligned64(p));
545 * Perform an aligned memory write of the target system
546 * byte ordered 8-bit value to the specified pointer address,
547 * perform byte reordering, as necessary, for the target system to
548 * put the value in big endian byte ordering.
550 * @param[inout] p A reference to an aligned pointer address
551 * to write the target system byte
552 * ordered 8-bit value to in big endian byte
553 * ordering and to then increment by 8-bits (1
556 * @param[in] v The 8-bit value to write.
559 static inline void WriteAligned8(void *&p, uint8_t v)
561 IO::WriteAligned8(p, v);
565 * Perform an aligned memory write of the target system
566 * byte ordered 16-bit value to the specified pointer address,
567 * perform byte reordering, as necessary, for the target system to
568 * put the value in big endian byte ordering.
570 * @param[inout] p A reference to an aligned pointer address
571 * to write the target system byte
572 * ordered 16-bit value to in big endian byte
573 * ordering and to then increment by 16-bits (2
576 * @param[in] v The 16-bit value to write.
579 static inline void WriteAligned16(void *&p, uint16_t v)
581 IO::WriteAligned16(p, ByteOrder::Swap16HostToBig(v));
585 * Perform an aligned memory write of the target system
586 * byte ordered 32-bit value to the specified pointer address,
587 * perform byte reordering, as necessary, for the target system to
588 * put the value in big endian byte ordering.
590 * @param[inout] p A reference to an aligned pointer address
591 * to write the target system byte
592 * ordered 32-bit value to in big endian byte
593 * ordering and to then increment by 16-bits (4
596 * @param[in] v The 32-bit value to write.
599 static inline void WriteAligned32(void *&p, uint32_t v)
601 IO::WriteAligned32(p, ByteOrder::Swap32HostToBig(v));
605 * Perform an aligned memory write of the target system
606 * byte ordered 64-bit value to the specified pointer address,
607 * perform byte reordering, as necessary, for the target system to
608 * put the value in big endian byte ordering.
610 * @param[inout] p A reference to an aligned pointer address
611 * to write the target system byte
612 * ordered 64-bit value to in big endian byte
613 * ordering and to then increment by 64-bits (8
616 * @param[in] v The 64-bit value to write.
619 static inline void WriteAligned64(void *&p, uint64_t v)
621 IO::WriteAligned64(p, ByteOrder::Swap64HostToBig(v));
625 * Perform an unaligned memory read of the big endian
626 * byte ordered 8-bit value from the specified pointer address,
627 * perform byte reordering, as necessary, for the target system to
628 * put the value in target system byte ordering.
630 * @param[in] p An unaligned pointer address to read
631 * the 8-bit big endian byte ordered value from.
633 * @return The 8-bit value at the specified pointer address.
635 static inline uint8_t GetUnaligned8(const void *p)
637 return IO::GetUnaligned8(p);
641 * Perform an unaligned memory read of the big endian
642 * byte ordered 16-bit value from the specified pointer address,
643 * perform byte reordering, as necessary, for the target system to
644 * put the value in target system byte ordering.
646 * @param[in] p An unaligned pointer address to read
647 * the 16-bit big endian byte ordered value from.
649 * @return The 16-bit value at the specified pointer address.
651 static inline uint16_t GetUnaligned16(const void *p)
653 return ByteOrder::Swap16BigToHost(IO::GetUnaligned16(p));
657 * Perform an unaligned memory read of the big endian
658 * byte ordered 32-bit value from the specified pointer address,
659 * perform byte reordering, as necessary, for the target system to
660 * put the value in target system byte ordering.
662 * @param[in] p An unaligned pointer address to read
663 * the 32-bit big endian byte ordered value from.
665 * @return The 32-bit value at the specified pointer address.
667 static inline uint32_t GetUnaligned32(const void *p)
669 return ByteOrder::Swap32BigToHost(IO::GetUnaligned32(p));
673 * Perform an unaligned memory read of the big endian
674 * byte ordered 64-bit value from the specified pointer address,
675 * perform byte reordering, as necessary, for the target system to
676 * put the value in target system byte ordering.
678 * @param[in] p An unaligned pointer address to read
679 * the 64-bit big endian byte ordered value from.
681 * @return The 64-bit value at the specified pointer address.
683 static inline uint64_t GetUnaligned64(const void *p)
685 return ByteOrder::Swap64BigToHost(IO::GetUnaligned64(p));
689 * Perform an unaligned memory write of the target system
690 * byte ordered 8-bit value to the specified pointer address,
691 * perform byte reordering, as necessary, for the target system to
692 * put the value in big endian byte ordering.
694 * @param[in] p An unaligned pointer address to write
695 * the target system byte ordered 8-bit value to in big
696 * endian byte ordering.
698 * @param[in] v The 8-bit value to write.
701 static inline void PutUnaligned8(void *p, uint8_t v)
703 IO::PutUnaligned8(p, v);
707 * Perform an unaligned memory write of the target system
708 * byte ordered 16-bit value to the specified pointer address,
709 * perform byte reordering, as necessary, for the target system to
710 * put the value in big endian byte ordering.
712 * @param[in] p An unaligned pointer address to write
713 * the target system byte ordered 16-bit value to in big
714 * endian byte ordering.
716 * @param[in] v The 16-bit value to write.
719 static inline void PutUnaligned16(void *p, uint16_t v)
721 IO::PutUnaligned16(p, ByteOrder::Swap16HostToBig(v));
725 * Perform an unaligned memory write of the target system
726 * byte ordered 32-bit value to the specified pointer address,
727 * perform byte reordering, as necessary, for the target system to
728 * put the value in big endian byte ordering.
730 * @param[in] p An unaligned pointer address to write
731 * the target system byte ordered 32-bit value to in big
732 * endian byte ordering.
734 * @param[in] v The 32-bit value to write.
737 static inline void PutUnaligned32(void *p, uint32_t v)
739 IO::PutUnaligned32(p, ByteOrder::Swap32HostToBig(v));
743 * Perform an unaligned memory write of the target system
744 * byte ordered 64-bit value to the specified pointer address,
745 * perform byte reordering, as necessary, for the target system to
746 * put the value in big endian byte ordering.
748 * @param[in] p An unaligned pointer address to write
749 * the target system byte ordered 64-bit value to in big
750 * endian byte ordering.
752 * @param[in] v The 64-bit value to write.
755 static inline void PutUnaligned64(void *p, uint64_t v)
757 IO::PutUnaligned64(p, ByteOrder::Swap64HostToBig(v));
761 * Perform an unaligned memory read of the big endian
762 * byte ordered 8-bit value from the specified pointer address,
763 * perform byte reordering, as necessary, for the target system to put
764 * the value in target system byte ordering, and increment the pointer
765 * by 8-bits (1 byte).
767 * @param[inout] p A reference to an unaligned pointer address
768 * to read the 8-bit big endian byte
769 * ordered value from and to then increment by 8-
772 * @return The 8-bit value at the specified pointer address.
774 static inline uint8_t ReadUnaligned8(const void *&p)
776 return IO::ReadUnaligned8(p);
780 * Perform an unaligned memory read of the big endian
781 * byte ordered 16-bit value from the specified pointer address,
782 * perform byte reordering, as necessary, for the target system to put
783 * the value in target system byte ordering, and increment the pointer
784 * by 16-bits (2 bytes).
786 * @param[inout] p A reference to an unaligned pointer address
787 * to read the 16-bit big endian byte
788 * ordered value from and to then increment by 16-
791 * @return The 16-bit value at the specified pointer address.
793 static inline uint16_t ReadUnaligned16(const void *&p)
795 return ByteOrder::Swap16BigToHost(IO::ReadUnaligned16(p));
799 * Perform an unaligned memory read of the big endian
800 * byte ordered 32-bit value from the specified pointer address,
801 * perform byte reordering, as necessary, for the target system to put
802 * the value in target system byte ordering, and increment the pointer
803 * by 32-bits (4 bytes).
805 * @param[inout] p A reference to an unaligned pointer address
806 * to read the 32-bit big endian byte
807 * ordered value from and to then increment by 32-
810 * @return The 32-bit value at the specified pointer address.
812 static inline uint32_t ReadUnaligned32(const void *&p)
814 return ByteOrder::Swap32BigToHost(IO::ReadUnaligned32(p));
818 * Perform an unaligned memory read of the big endian
819 * byte ordered 64-bit value from the specified pointer address,
820 * perform byte reordering, as necessary, for the target system to put
821 * the value in target system byte ordering, and increment the pointer
822 * by 64-bits (8 bytes).
824 * @param[inout] p A reference to an unaligned pointer address
825 * to read the 64-bit big endian byte
826 * ordered value from and to then increment by 64-
829 * @return The 64-bit value at the specified pointer address.
831 static inline uint64_t ReadUnaligned64(const void *&p)
833 return ByteOrder::Swap64BigToHost(IO::ReadUnaligned64(p));
837 * Perform an unaligned memory write of the target system
838 * byte ordered 8-bit value to the specified pointer address,
839 * perform byte reordering, as necessary, for the target system to
840 * put the value in big endian byte ordering.
842 * @param[inout] p A reference to an unaligned pointer address
843 * to write the target system byte
844 * ordered 8-bit value to in big endian byte
845 * ordering and to then increment by 8-bits (1
848 * @param[in] v The 8-bit value to write.
851 static inline void WriteUnaligned8(void *&p, uint8_t v)
853 IO::WriteUnaligned8(p, v);
857 * Perform an unaligned memory write of the target system
858 * byte ordered 16-bit value to the specified pointer address,
859 * perform byte reordering, as necessary, for the target system to
860 * put the value in big endian byte ordering.
862 * @param[inout] p A reference to an unaligned pointer address
863 * to write the target system byte
864 * ordered 16-bit value to in big endian byte
865 * ordering and to then increment by 16-bits (2
868 * @param[in] v The 16-bit value to write.
871 static inline void WriteUnaligned16(void *&p, uint16_t v)
873 IO::WriteUnaligned16(p, ByteOrder::Swap16HostToBig(v));
877 * Perform an unaligned memory write of the target system
878 * byte ordered 32-bit value to the specified pointer address,
879 * perform byte reordering, as necessary, for the target system to
880 * put the value in big endian byte ordering.
882 * @param[inout] p A reference to an unaligned pointer address
883 * to write the target system byte
884 * ordered 32-bit value to in big endian byte
885 * ordering and to then increment by 16-bits (4
888 * @param[in] v The 32-bit value to write.
891 static inline void WriteUnaligned32(void *&p, uint32_t v)
893 IO::WriteUnaligned32(p, ByteOrder::Swap32HostToBig(v));
897 * Perform an unaligned memory write of the target system
898 * byte ordered 64-bit value to the specified pointer address,
899 * perform byte reordering, as necessary, for the target system to
900 * put the value in big endian byte ordering.
902 * @param[inout] p A reference to an unaligned pointer address
903 * to write the target system byte
904 * ordered 64-bit value to in big endian byte
905 * ordering and to then increment by 64-bits (8
908 * @param[in] v The 64-bit value to write.
911 static inline void WriteUnaligned64(void *&p, uint64_t v)
913 IO::WriteUnaligned64(p, ByteOrder::Swap64HostToBig(v));
916 } // namespace BigEndian
922 #endif // NLIO_BYTEORDER_BIG_HPP