summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-03-15 15:38:19 +0800
committerPo Lu <luangruo@yahoo.com>2023-03-15 15:38:19 +0800
commit8fbac937fbaf0d74ded6eebdf6acd4636d7b00ea (patch)
tree3cd6e131b0b90db530117c83681e7d537612a18e /lib-src
parent5b9d6738d119d2c450dd8f060793aebe3f64fc72 (diff)
downloademacs-8fbac937fbaf0d74ded6eebdf6acd4636d7b00ea.tar.gz
Port to systems without endian.h
* lib-src/asset-directory-tool.c (main_2): Port to systems without htole32.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/asset-directory-tool.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib-src/asset-directory-tool.c b/lib-src/asset-directory-tool.c
index e53398eceb0..239ab083b66 100644
--- a/lib-src/asset-directory-tool.c
+++ b/lib-src/asset-directory-tool.c
@@ -22,7 +22,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
-#include <endian.h>
+#include <byteswap.h>
#include <stdlib.h>
#include <dirent.h>
#include <string.h>
@@ -197,7 +197,11 @@ main_2 (int fd, struct directory_tree *tree, size_t *offset)
croak ("write");
/* Write the offset. */
- output = htole32 (tree->offset);
+#ifdef WORDS_BIGENDIAN
+ output = bswap_32 (tree->offset);
+#else
+ output = tree->offset;
+#endif
if (write (fd, &output, 4) < 1)
croak ("write");
size += 4;