Lely core libraries  1.9.2
endian.h
Go to the documentation of this file.
1 
22 #ifndef LELY_UTIL_ENDIAN_H_
23 #define LELY_UTIL_ENDIAN_H_
24 
25 #include <lely/util/bits.h>
26 #include <lely/util/float.h>
27 
28 #include <string.h>
29 
30 #ifndef LELY_UTIL_ENDIAN_INLINE
31 #define LELY_UTIL_ENDIAN_INLINE static inline
32 #endif
33 
34 #ifndef LELY_BIG_ENDIAN
35 #if defined(__BIG_ENDIAN__) || defined(__big_endian__) \
36  || (__GNUC__ && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) \
37  || defined(__ARMEB__) || defined(__AARCH64EB__) \
38  || defined(__THUMBEB__)
39 #define LELY_BIG_ENDIAN 1
41 #endif
42 #endif
43 
44 #if LELY_BIG_ENDIAN
45 #undef LELY_LITTLE_ENDIAN
46 #endif
47 
48 #ifndef LELY_LITTLE_ENDIAN
49 #if defined(__LITTLE_ENDIAN__) || defined(__little_endian__) \
50  || (__GNUC__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) \
51  || defined(__i386__) || defined(_M_IX86) \
52  || defined(__x86_64__) || defined(_M_AMD64) \
53  || defined(__ARMEL__) || defined(__AARCH64EL__) \
54  || defined(__THUMBEL__)
55 #define LELY_LITTLE_ENDIAN 1
57 #endif
58 #endif
59 
60 #if LELY_LITTLE_ENDIAN
61 #undef LELY_BIG_ENDIAN
62 #endif
63 
64 #if !LELY_BIG_ENDIAN && !LELY_LITTLE_ENDIAN
65 #error Unable to determine byte order or byte order is not supported.
66 #endif
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
72 #ifndef htobe16
73 LELY_UTIL_ENDIAN_INLINE uint_least16_t htobe16(uint_least16_t x);
75 #endif
76 
77 #ifndef betoh16
78 LELY_UTIL_ENDIAN_INLINE uint_least16_t betoh16(uint_least16_t x);
80 #endif
81 
82 #ifndef htole16
83 LELY_UTIL_ENDIAN_INLINE uint_least16_t htole16(uint_least16_t x);
85 #endif
86 
87 #ifndef letoh16
88 LELY_UTIL_ENDIAN_INLINE uint_least16_t letoh16(uint_least16_t x);
90 #endif
91 
92 #ifndef htobe32
93 LELY_UTIL_ENDIAN_INLINE uint_least32_t htobe32(uint_least32_t x);
95 #endif
96 
97 #ifndef betoh32
98 LELY_UTIL_ENDIAN_INLINE uint_least32_t betoh32(uint_least32_t x);
100 #endif
101 
102 #ifndef htole32
103 LELY_UTIL_ENDIAN_INLINE uint_least32_t htole32(uint_least32_t x);
105 #endif
106 
107 #ifndef letoh32
108 LELY_UTIL_ENDIAN_INLINE uint_least32_t letoh32(uint_least32_t x);
110 #endif
111 
112 #ifndef htobe64
113 LELY_UTIL_ENDIAN_INLINE uint_least64_t htobe64(uint_least64_t x);
115 #endif
116 
117 #ifndef betoh64
118 LELY_UTIL_ENDIAN_INLINE uint_least64_t betoh64(uint_least64_t x);
120 #endif
121 
122 #ifndef htole64
123 LELY_UTIL_ENDIAN_INLINE uint_least64_t htole64(uint_least64_t x);
125 #endif
126 
127 #ifndef letoh64
128 LELY_UTIL_ENDIAN_INLINE uint_least64_t letoh64(uint_least64_t x);
130 #endif
131 
133 LELY_UTIL_ENDIAN_INLINE void stbe_i16(void *ptr, int_least16_t x);
134 
136 LELY_UTIL_ENDIAN_INLINE int_least16_t ldbe_i16(const void *ptr);
137 
139 LELY_UTIL_ENDIAN_INLINE void stbe_u16(void *ptr, uint_least16_t x);
140 
142 LELY_UTIL_ENDIAN_INLINE uint_least16_t ldbe_u16(const void *ptr);
143 
145 LELY_UTIL_ENDIAN_INLINE void stle_i16(void *ptr, int_least16_t x);
146 
148 LELY_UTIL_ENDIAN_INLINE int_least16_t ldle_i16(const void *ptr);
149 
151 LELY_UTIL_ENDIAN_INLINE void stle_u16(void *ptr, uint_least16_t x);
152 
154 LELY_UTIL_ENDIAN_INLINE uint_least16_t ldle_u16(const void *ptr);
155 
157 LELY_UTIL_ENDIAN_INLINE void stbe_i32(void *ptr, int_least32_t x);
158 
160 LELY_UTIL_ENDIAN_INLINE int_least32_t ldbe_i32(const void *ptr);
161 
163 LELY_UTIL_ENDIAN_INLINE void stbe_u32(void *ptr, uint_least32_t x);
164 
166 LELY_UTIL_ENDIAN_INLINE uint_least32_t ldbe_u32(const void *ptr);
167 
169 LELY_UTIL_ENDIAN_INLINE void stle_i32(void *ptr, int_least32_t x);
170 
172 LELY_UTIL_ENDIAN_INLINE int_least32_t ldle_i32(const void *ptr);
173 
175 LELY_UTIL_ENDIAN_INLINE void stle_u32(void *ptr, uint_least32_t x);
176 
178 LELY_UTIL_ENDIAN_INLINE uint_least32_t ldle_u32(const void *ptr);
179 
181 LELY_UTIL_ENDIAN_INLINE void stbe_i64(void *ptr, int_least64_t x);
182 
184 LELY_UTIL_ENDIAN_INLINE int_least64_t ldbe_i64(const void *ptr);
185 
187 LELY_UTIL_ENDIAN_INLINE void stbe_u64(void *ptr, uint_least64_t x);
188 
190 LELY_UTIL_ENDIAN_INLINE uint_least64_t ldbe_u64(const void *ptr);
191 
193 LELY_UTIL_ENDIAN_INLINE void stle_i64(void *ptr, int_least64_t x);
194 
196 LELY_UTIL_ENDIAN_INLINE int_least64_t ldle_i64(const void *ptr);
197 
199 LELY_UTIL_ENDIAN_INLINE void stle_u64(void *ptr, uint_least64_t x);
200 
202 LELY_UTIL_ENDIAN_INLINE uint_least64_t ldle_u64(const void *ptr);
203 
204 #ifdef LELY_FLT16_TYPE
205 
210 LELY_UTIL_ENDIAN_INLINE void stbe_flt16(void *ptr, flt16_t x);
211 
216 LELY_UTIL_ENDIAN_INLINE flt16_t ldbe_flt16(const void *ptr);
217 
222 LELY_UTIL_ENDIAN_INLINE void stle_flt16(void *ptr, flt16_t x);
223 
228 LELY_UTIL_ENDIAN_INLINE flt16_t ldle_flt16(const void *ptr);
229 
230 #endif // LELY_FLT16_TYPE
231 
232 #ifdef LELY_FLT32_TYPE
233 
238 LELY_UTIL_ENDIAN_INLINE void stbe_flt32(void *ptr, flt32_t x);
239 
244 LELY_UTIL_ENDIAN_INLINE flt32_t ldbe_flt32(const void *ptr);
245 
250 LELY_UTIL_ENDIAN_INLINE void stle_flt32(void *ptr, flt32_t x);
251 
256 LELY_UTIL_ENDIAN_INLINE flt32_t ldle_flt32(const void *ptr);
257 
258 #endif // LELY_FLT32_TYPE
259 
260 #ifdef LELY_FLT64_TYPE
261 
266 LELY_UTIL_ENDIAN_INLINE void stbe_flt64(void *ptr, flt64_t x);
267 
272 LELY_UTIL_ENDIAN_INLINE flt64_t ldbe_flt64(const void *ptr);
273 
278 LELY_UTIL_ENDIAN_INLINE void stle_flt64(void *ptr, flt64_t x);
279 
284 LELY_UTIL_ENDIAN_INLINE flt64_t ldle_flt64(const void *ptr);
285 
286 #endif // LELY_FLT64_TYPE
287 
299 void bcpybe(void *dst, int dstbit, const void *src, int srcbit, size_t n);
300 
312 void bcpyle(void *dst, int dstbit, const void *src, int srcbit, size_t n);
313 
314 #ifndef htobe16
315 inline uint_least16_t
316 htobe16(uint_least16_t x)
317 {
318  x &= UINT16_C(0xffff);
319 #if LELY_BIG_ENDIAN
320  return x;
321 #elif LELY_LITTLE_ENDIAN
322  return bswap16(x);
323 #endif
324 }
325 #endif
326 
327 #ifndef betoh16
328 inline uint_least16_t
329 betoh16(uint_least16_t x)
330 {
331  return htobe16(x);
332 }
333 #endif
334 
335 #ifndef htole16
336 inline uint_least16_t
337 htole16(uint_least16_t x)
338 {
339  x &= UINT16_C(0xffff);
340 #if LELY_BIG_ENDIAN
341  return bswap16(x);
342 #elif LELY_LITTLE_ENDIAN
343  return x;
344 #endif
345 }
346 #endif
347 
348 #ifndef letoh16
349 inline uint_least16_t
350 letoh16(uint_least16_t x)
351 {
352  return htole16(x);
353 }
354 #endif
355 
356 #ifndef htobe32
357 inline uint_least32_t
358 htobe32(uint_least32_t x)
359 {
360  x &= UINT32_C(0xffffffff);
361 #if LELY_BIG_ENDIAN
362  return x;
363 #elif LELY_LITTLE_ENDIAN
364  return bswap32(x);
365 #endif
366 }
367 #endif
368 
369 #ifndef betoh32
370 inline uint_least32_t
371 betoh32(uint_least32_t x)
372 {
373  return htobe32(x);
374 }
375 #endif
376 
377 #ifndef htole32
378 inline uint_least32_t
379 htole32(uint_least32_t x)
380 {
381  x &= UINT32_C(0xffffffff);
382 #if LELY_BIG_ENDIAN
383  return bswap32(x);
384 #elif LELY_LITTLE_ENDIAN
385  return x;
386 #endif
387 }
388 #endif
389 
390 #ifndef letoh32
391 inline uint_least32_t
392 letoh32(uint_least32_t x)
393 {
394  return htole32(x);
395 }
396 #endif
397 
398 #ifndef htobe64
399 inline uint_least64_t
400 htobe64(uint_least64_t x)
401 {
402  x &= UINT64_C(0xffffffffffffffff);
403 #if LELY_BIG_ENDIAN
404  return x;
405 #elif LELY_LITTLE_ENDIAN
406  return bswap64(x);
407 #endif
408 }
409 #endif
410 
411 #ifndef betoh64
412 inline uint_least64_t
413 betoh64(uint_least64_t x)
414 {
415  return htobe64(x);
416 }
417 #endif
418 
419 #ifndef htole64
420 inline uint_least64_t
421 htole64(uint_least64_t x)
422 {
423  x &= UINT64_C(0xffffffffffffffff);
424 #if LELY_BIG_ENDIAN
425  return bswap64(x);
426 #elif LELY_LITTLE_ENDIAN
427  return x;
428 #endif
429 }
430 #endif
431 
432 #ifndef letoh64
433 inline uint_least64_t
434 letoh64(uint_least64_t x)
435 {
436  return htole64(x);
437 }
438 #endif
439 
440 inline void
441 stbe_i16(void *ptr, int_least16_t x)
442 {
443  stbe_u16(ptr, x);
444 }
445 
446 inline int_least16_t
447 ldbe_i16(const void *ptr)
448 {
449  return ldbe_u16(ptr);
450 }
451 
452 inline void
453 stbe_u16(void *ptr, uint_least16_t x)
454 {
455  x = htobe16(x);
456  memcpy(ptr, &x, sizeof(x));
457 }
458 
459 inline uint_least16_t
460 ldbe_u16(const void *ptr)
461 {
462  uint_least16_t x = 0;
463  memcpy(&x, ptr, sizeof(x));
464  return betoh16(x);
465 }
466 
467 inline void
468 stle_i16(void *ptr, int_least16_t x)
469 {
470  stle_u16(ptr, x);
471 }
472 
473 inline int_least16_t
474 ldle_i16(const void *ptr)
475 {
476  return ldle_u16(ptr);
477 }
478 
479 inline void
480 stle_u16(void *ptr, uint_least16_t x)
481 {
482  x = htole16(x);
483  memcpy(ptr, &x, sizeof(x));
484 }
485 
486 inline uint_least16_t
487 ldle_u16(const void *ptr)
488 {
489  uint_least16_t x = 0;
490  memcpy(&x, ptr, sizeof(x));
491  return letoh16(x);
492 }
493 
494 inline void
495 stbe_i32(void *ptr, int_least32_t x)
496 {
497  stbe_u32(ptr, x);
498 }
499 
500 inline int_least32_t
501 ldbe_i32(const void *ptr)
502 {
503  return ldbe_u32(ptr);
504 }
505 
506 inline void
507 stbe_u32(void *ptr, uint_least32_t x)
508 {
509  x = htobe32(x);
510  memcpy(ptr, &x, sizeof(x));
511 }
512 
513 inline uint_least32_t
514 ldbe_u32(const void *ptr)
515 {
516  uint_least32_t x = 0;
517  memcpy(&x, ptr, sizeof(x));
518  return betoh32(x);
519 }
520 
521 inline void
522 stle_i32(void *ptr, int_least32_t x)
523 {
524  stle_u32(ptr, x);
525 }
526 
527 inline int_least32_t
528 ldle_i32(const void *ptr)
529 {
530  return ldle_u32(ptr);
531 }
532 
533 inline void
534 stle_u32(void *ptr, uint_least32_t x)
535 {
536  x = htole32(x);
537  memcpy(ptr, &x, sizeof(x));
538 }
539 
540 inline uint_least32_t
541 ldle_u32(const void *ptr)
542 {
543  uint_least32_t x = 0;
544  memcpy(&x, ptr, sizeof(x));
545  return letoh32(x);
546 }
547 
548 inline void
549 stbe_i64(void *ptr, int_least64_t x)
550 {
551  stbe_u64(ptr, x);
552 }
553 
554 inline int_least64_t
555 ldbe_i64(const void *ptr)
556 {
557  return ldbe_u64(ptr);
558 }
559 
560 inline void
561 stbe_u64(void *ptr, uint_least64_t x)
562 {
563  x = htobe64(x);
564  memcpy(ptr, &x, sizeof(x));
565 }
566 
567 inline uint_least64_t
568 ldbe_u64(const void *ptr)
569 {
570  uint_least64_t x = 0;
571  memcpy(&x, ptr, sizeof(x));
572  return betoh64(x);
573 }
574 
575 inline void
576 stle_i64(void *ptr, int_least64_t x)
577 {
578  stle_u64(ptr, x);
579 }
580 
581 inline int_least64_t
582 ldle_i64(const void *ptr)
583 {
584  return ldle_u64(ptr);
585 }
586 
587 inline void
588 stle_u64(void *ptr, uint_least64_t x)
589 {
590  x = htole64(x);
591  memcpy(ptr, &x, sizeof(x));
592 }
593 
594 inline uint_least64_t
595 ldle_u64(const void *ptr)
596 {
597  uint_least64_t x = 0;
598  memcpy(&x, ptr, sizeof(x));
599  return letoh64(x);
600 }
601 
602 #ifdef LELY_FLT16_TYPE
603 
604 inline void
605 stbe_flt16(void *ptr, flt16_t x)
606 {
607  uint_least16_t tmp = 0;
608  memcpy(&tmp, &x, sizeof(x));
609  stbe_u16(ptr, tmp);
610 }
611 
612 inline flt16_t
613 ldbe_flt16(const void *ptr)
614 {
615  flt16_t x = 0;
616  uint_least16_t tmp = ldbe_u16(ptr);
617  memcpy(&x, &tmp, sizeof(x));
618  return x;
619 }
620 
621 inline void
622 stle_flt16(void *ptr, flt16_t x)
623 {
624  uint_least16_t tmp = 0;
625  memcpy(&tmp, &x, sizeof(x));
626  stle_u16(ptr, tmp);
627 }
628 
629 inline flt16_t
630 ldle_flt16(const void *ptr)
631 {
632  flt16_t x = 0;
633  uint_least16_t tmp = ldle_u16(ptr);
634  memcpy(&x, &tmp, sizeof(x));
635  return x;
636 }
637 
638 #endif // LELY_FLT16_TYPE
639 
640 #ifdef LELY_FLT32_TYPE
641 
642 inline void
643 stbe_flt32(void *ptr, flt32_t x)
644 {
645  uint_least32_t tmp = 0;
646  memcpy(&tmp, &x, sizeof(x));
647  stbe_u32(ptr, tmp);
648 }
649 
650 inline flt32_t
651 ldbe_flt32(const void *ptr)
652 {
653  flt32_t x = 0;
654  uint_least32_t tmp = ldbe_u32(ptr);
655  memcpy(&x, &tmp, sizeof(x));
656  return x;
657 }
658 
659 inline void
660 stle_flt32(void *ptr, flt32_t x)
661 {
662  uint_least32_t tmp = 0;
663  memcpy(&tmp, &x, sizeof(x));
664  stle_u32(ptr, tmp);
665 }
666 
667 inline flt32_t
668 ldle_flt32(const void *ptr)
669 {
670  flt32_t x = 0;
671  uint_least32_t tmp = ldle_u32(ptr);
672  memcpy(&x, &tmp, sizeof(x));
673  return x;
674 }
675 
676 #endif // LELY_FLT32_TYPE
677 
678 #ifdef LELY_FLT64_TYPE
679 
680 inline void
681 stbe_flt64(void *ptr, flt64_t x)
682 {
683  uint_least64_t tmp = 0;
684  memcpy(&tmp, &x, sizeof(x));
685  stbe_u64(ptr, tmp);
686 }
687 
688 inline flt64_t
689 ldbe_flt64(const void *ptr)
690 {
691  flt64_t x = 0;
692  uint_least64_t tmp = ldbe_u64(ptr);
693  memcpy(&x, &tmp, sizeof(x));
694  return x;
695 }
696 
697 inline void
698 stle_flt64(void *ptr, flt64_t x)
699 {
700  uint_least64_t tmp = 0;
701  memcpy(&tmp, &x, sizeof(x));
702  stle_u64(ptr, tmp);
703 }
704 
705 inline flt64_t
706 ldle_flt64(const void *ptr)
707 {
708  flt64_t x = 0;
709  uint_least64_t tmp = ldle_u64(ptr);
710  memcpy(&x, &tmp, sizeof(x));
711  return x;
712 }
713 
714 #endif // LELY_FLT64_TYPE
715 
716 #ifdef __cplusplus
717 }
718 #endif
719 
720 #endif // !LELY_UTIL_ENDIAN_H_
uint_least16_t htole16(uint_least16_t x)
Converts a 16-bit unsigned integer from host to little-endian byte order.
Definition: endian.h:337
void stbe_u16(void *ptr, uint_least16_t x)
Stores a 16-bit unsigned integer in big-endian byte order.
Definition: endian.h:453
void stle_u32(void *ptr, uint_least32_t x)
Stores a 32-bit unsigned integer in little-endian byte order.
Definition: endian.h:534
uint_least32_t betoh32(uint_least32_t x)
Converts a 32-bit unsigned integer from big-endian to host byte order.
Definition: endian.h:371
void stle_u64(void *ptr, uint_least64_t x)
Stores a 64-bit unsigned integer in little-endian byte order.
Definition: endian.h:588
This header file is part of the C11 and POSIX compatibility library; it includes <string.h> and defines any missing functionality.
uint_least32_t letoh32(uint_least32_t x)
Converts a 32-bit unsigned integer from little-endian to host byte order.
Definition: endian.h:392
uint_least64_t ldle_u64(const void *ptr)
Loads a 64-bit unsigned integer in little-endian byte order.
Definition: endian.h:595
int_least64_t ldbe_i64(const void *ptr)
Loads a 64-bit signed integer in big-endian byte order.
Definition: endian.h:555
uint_least64_t bswap64(uint_least64_t x)
Reverses the byte order of the 64-bit unsigned integer x.
Definition: bits.h:308
int_least32_t ldbe_i32(const void *ptr)
Loads a 32-bit signed integer in big-endian byte order.
Definition: endian.h:501
int_least32_t ldle_i32(const void *ptr)
Loads a 32-bit signed integer in little-endian byte order.
Definition: endian.h:528
uint_least16_t ldbe_u16(const void *ptr)
Loads a 16-bit unsigned integer in big-endian byte order.
Definition: endian.h:460
uint_least16_t ldle_u16(const void *ptr)
Loads a 16-bit unsigned integer in little-endian byte order.
Definition: endian.h:487
void bcpyle(void *dst, int dstbit, const void *src, int srcbit, size_t n)
Copies n bits from a source to a destination buffer.
Definition: endian.c:128
This header file is part of the utilities library; it contains the IEEE 754 floating-point format typ...
uint_least64_t htobe64(uint_least64_t x)
Converts a 64-bit unsigned integer from host to big-endian byte order.
Definition: endian.h:400
void stbe_i16(void *ptr, int_least16_t x)
Stores a 16-bit signed integer in big-endian byte order.
Definition: endian.h:441
void stle_i32(void *ptr, int_least32_t x)
Stores a 32-bit signed integer in little-endian byte order.
Definition: endian.h:522
void stbe_u64(void *ptr, uint_least64_t x)
Stores a 64-bit unsigned integer in big-endian byte order.
Definition: endian.h:561
void stle_i16(void *ptr, int_least16_t x)
Stores a 16-bit signed integer in little-endian byte order.
Definition: endian.h:468
uint_least16_t htobe16(uint_least16_t x)
Converts a 16-bit unsigned integer from host to big-endian byte order.
Definition: endian.h:316
void stbe_i64(void *ptr, int_least64_t x)
Stores a 64-bit signed integer in big-endian byte order.
Definition: endian.h:549
uint_least32_t ldbe_u32(const void *ptr)
Loads a 32-bit unsigned integer in big-endian byte order.
Definition: endian.h:514
void stle_u16(void *ptr, uint_least16_t x)
Stores a 16-bit unsigned integer in little-endian byte order.
Definition: endian.h:480
uint_least64_t betoh64(uint_least64_t x)
Converts a 64-bit unsigned integer from big-endian to host byte order.
Definition: endian.h:413
int_least16_t ldle_i16(const void *ptr)
Loads a 16-bit signed integer in little-endian byte order.
Definition: endian.h:474
uint_least64_t ldbe_u64(const void *ptr)
Loads a 64-bit unsigned integer in big-endian byte order.
Definition: endian.h:568
uint_least32_t htole32(uint_least32_t x)
Converts a 32-bit unsigned integer from host to little-endian byte order.
Definition: endian.h:379
uint_least16_t letoh16(uint_least16_t x)
Converts a 16-bit unsigned integer from little-endian to host byte order.
Definition: endian.h:350
void stbe_u32(void *ptr, uint_least32_t x)
Stores a 32-bit unsigned integer in big-endian byte order.
Definition: endian.h:507
This header file is part of the utilities library; it contains the bit function definitions.
void stle_i64(void *ptr, int_least64_t x)
Stores a 64-bit signed integer in little-endian byte order.
Definition: endian.h:576
uint_least32_t bswap32(uint_least32_t x)
Reverses the byte order of the 32-bit unsigned integer x.
Definition: bits.h:296
uint_least16_t bswap16(uint_least16_t x)
Reverses the byte order of the 16-bit unsigned integer x.
Definition: bits.h:284
void stbe_i32(void *ptr, int_least32_t x)
Stores a 32-bit signed integer in big-endian byte order.
Definition: endian.h:495
void bcpybe(void *dst, int dstbit, const void *src, int srcbit, size_t n)
Copies n bits from a source to a destination buffer.
Definition: endian.c:38
uint_least64_t letoh64(uint_least64_t x)
Converts a 64-bit unsigned integer from little-endian to host byte order.
Definition: endian.h:434
int_least16_t ldbe_i16(const void *ptr)
Loads a 16-bit signed integer in big-endian byte order.
Definition: endian.h:447
uint_least16_t betoh16(uint_least16_t x)
Converts a 16-bit unsigned integer from big-endian to host byte order.
Definition: endian.h:329
int_least64_t ldle_i64(const void *ptr)
Loads a 64-bit signed integer in little-endian byte order.
Definition: endian.h:582
uint_least32_t ldle_u32(const void *ptr)
Loads a 32-bit unsigned integer in little-endian byte order.
Definition: endian.h:541
uint_least32_t htobe32(uint_least32_t x)
Converts a 32-bit unsigned integer from host to big-endian byte order.
Definition: endian.h:358
uint_least64_t htole64(uint_least64_t x)
Converts a 64-bit unsigned integer from host to little-endian byte order.
Definition: endian.h:421