]> git.eshelyaron.com Git - emacs.git/commitdiff
Port to systems without endian.h
authorPo Lu <luangruo@yahoo.com>
Wed, 15 Mar 2023 07:38:19 +0000 (15:38 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 15 Mar 2023 07:38:19 +0000 (15:38 +0800)
* lib-src/asset-directory-tool.c (main_2): Port to systems
without htole32.

lib-src/asset-directory-tool.c

index e53398eceb0a0c4561c758a9e2cde654f6d5c0db..239ab083b660ae82c08a4a36fe0c8f9f3343ce94 100644 (file)
@@ -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;