provide a htobe32() replacement

This commit is contained in:
Damien Miller committed 2026-06-14 18:56:31 +10:00
1 parent 8e0cb47177
commit ea505c83ec
2 files changed
+10 -3

No files matched your search

+1 -1
View File
@@ -588,7 +588,7 @@ for include in sys/queue.h sys/tree.h; do
esac >"$header"
done
AC_CHECK_DECLS([le32toh, le64toh, htole64], [], [], [
AC_CHECK_DECLS([le32toh, le64toh, htole64, htobe32], [], [], [
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
+9 -2
View File
@@ -663,7 +663,8 @@ struct winsize {
#if (defined(HAVE_DECL_LE32TOH) && HAVE_DECL_LE32TOH == 0) || \
(defined(HAVE_DECL_LE64TOH) && HAVE_DECL_LE64TOH == 0) || \
(defined(HAVE_DECL_HTOLE64) && HAVE_DECL_HTOLE64 == 0)
(defined(HAVE_DECL_HTOLE64) && HAVE_DECL_HTOLE64 == 0) || \
(defined(HAVE_DECL_HTOBE32) && HAVE_DECL_HTOBE32 == 0)
# define openssh_swap32(v) \
(uint32_t)(((uint32_t)(v) & 0xff) << 24 | \
((uint32_t)(v) & 0xff00) << 8 | \
@@ -687,7 +688,10 @@ struct winsize {
# endif
# if defined(HAVE_DECL_HTOLE64) && HAVE_DECL_HTOLE64 == 0
# define htole64(v) (openssh_swap64(v))
# endif
# endif
# if defined(HAVE_DECL_HTOBE32) && HAVE_DECL_HTOBE32 == 0
# define htobe32(v) ((uint32_t)v)
# endif
# else
# if defined(HAVE_DECL_LE32TOH) && HAVE_DECL_LE32TOH == 0
# define le32toh(v) ((uint32_t)v)
@@ -698,6 +702,9 @@ struct winsize {
# if defined(HAVE_DECL_HTOLE64) && HAVE_DECL_HTOLE64 == 0
# define htole64(v) ((uint64_t)v)
# endif
# if defined(HAVE_DECL_HTOBE32) && HAVE_DECL_HTOBE32 == 0
# define htobe32(v) (openssh_swap32(v))
# endif
# endif
#endif