File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -2013,7 +2013,6 @@ AC_CHECK_FUNCS([ \
20132013 strtoll \
20142014 strtoul \
20152015 strtoull \
2016- swap32 \
20172016 sysconf \
20182017 tcgetpgrp \
20192018 timegm \
Original file line number Diff line number Diff line change @@ -646,6 +646,32 @@ struct winsize {
646646# endif /* WORDS_BIGENDIAN */
647647#endif /* BYTE_ORDER */
648648
649+ #ifndef HAVE_ENDIAN_H
650+ # define openssh_swap32 (v ) \
651+ (uint32_t)(((uint32_t)(v) & 0xff) << 24 | \
652+ ((uint32_t)(v) & 0xff00) << 8 | \
653+ ((uint32_t)(v) & 0xff0000) >> 8 | \
654+ ((uint32_t)(v) & 0xff000000) >> 24)
655+ # define openssh_swap64 (v ) \
656+ (__uint64_t)((((__uint64_t)(v) & 0xff) << 56) | \
657+ ((__uint64_t)(v) & 0xff00ULL) << 40 | \
658+ ((__uint64_t)(v) & 0xff0000ULL) << 24 | \
659+ ((__uint64_t)(v) & 0xff000000ULL) << 8 | \
660+ ((__uint64_t)(v) & 0xff00000000ULL) >> 8 | \
661+ ((__uint64_t)(v) & 0xff0000000000ULL) >> 24 | \
662+ ((__uint64_t)(v) & 0xff000000000000ULL) >> 40 | \
663+ ((__uint64_t)(v) & 0xff00000000000000ULL) >> 56)
664+ # ifdef WORDS_BIGENDIAN
665+ # define le32toh (v ) (openssh_swap32(v))
666+ # define le64toh (v ) (openssh_swap64(v))
667+ # define htole64 (v ) (openssh_swap64(v))
668+ # else
669+ # define le32toh (v ) ((uint32_t)v)
670+ # define le64toh (v ) ((uint64_t)v)
671+ # define htole64 (v ) ((uint64_t)v)
672+ # endif
673+ #endif
674+
649675/* Function replacement / compatibility hacks */
650676
651677#if !defined(HAVE_GETADDRINFO ) && (defined(HAVE_OGETADDRINFO ) || defined(HAVE_NGETADDRINFO ))
You can’t perform that action at this time.
0 commit comments