This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
DO_BO_{UN,}PACK can use my_swabn() directly.
authorNicholas Clark <nick@ccl4.org>
Mon, 6 May 2013 16:43:26 +0000 (18:43 +0200)
committerNicholas Clark <nick@ccl4.org>
Mon, 20 May 2013 19:19:43 +0000 (21:19 +0200)
This removes the only users of my_{be,le,h}to{be,le,h}n, so remove the
definitions for those macros.

perl.h
pp_pack.c

diff --git a/perl.h b/perl.h
index b492f7c..3636147 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -795,27 +795,6 @@ EXTERN_C int usleep(unsigned int);
           (((U64)(x) & U64_CONST(0xff00000000000000)) >> 56) ))
 # endif
 
-/*----------------------------------------------------------------------------*/
-# if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678  /*     little-endian     */
-/*----------------------------------------------------------------------------*/
-#  define my_htolen(p,n)       NOOP
-#  define my_letohn(p,n)       NOOP
-#  define my_htoben(p,n)       my_swabn(p,n)
-#  define my_betohn(p,n)       my_swabn(p,n)
-/*----------------------------------------------------------------------------*/
-# elif BYTEORDER == 0x4321 || BYTEORDER == 0x87654321  /*     big-endian      */
-/*----------------------------------------------------------------------------*/
-#  define my_htolen(p,n)       my_swabn(p,n)
-#  define my_letohn(p,n)       my_swabn(p,n)
-#  define my_htoben(p,n)       NOOP
-#  define my_betohn(p,n)       NOOP
-/*----------------------------------------------------------------------------*/
-# else /*                       all other byte-orders                         */
-/*----------------------------------------------------------------------------*/
-/*----------------------------------------------------------------------------*/
-# endif /*                     end of byte-order macros                       */
-/*----------------------------------------------------------------------------*/
-
 /* The old value was hard coded at 1008. (4096-16) seems to be a bit faster,
    at least on FreeBSD.  YMMV, so experiment.  */
 #ifndef PERL_ARENA_SIZE
index 54a7a5c..d85eea2 100644 (file)
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -242,14 +242,14 @@ S_mul128(pTHX_ SV *sv, U8 m)
 # define DO_BO_UNPACK(var, type)                                              \
         STMT_START {                                                          \
           if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_LITTLE_ENDIAN) {          \
-            my_letohn(&var, sizeof(var));                                     \
+            my_swabn(&var, sizeof(var));                                      \
           }                                                                   \
         } STMT_END
 
 # define DO_BO_PACK(var, type)                                                \
         STMT_START {                                                          \
           if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_LITTLE_ENDIAN) {          \
-            my_htolen(&var, sizeof(var));                                     \
+            my_swabn(&var, sizeof(var));                                      \
           }                                                                   \
         } STMT_END
 
@@ -258,14 +258,14 @@ S_mul128(pTHX_ SV *sv, U8 m)
 # define DO_BO_UNPACK(var, type)                                              \
         STMT_START {                                                          \
           if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_BIG_ENDIAN) {             \
-            my_betohn(&var, sizeof(var));                                     \
+            my_swabn(&var, sizeof(var));                                      \
           }                                                                   \
         } STMT_END
 
 # define DO_BO_PACK(var, type)                                                \
         STMT_START {                                                          \
           if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_BIG_ENDIAN) {             \
-            my_htoben(&var, sizeof(var));                                     \
+            my_swabn(&var, sizeof(var));                                      \
           }                                                                   \
         } STMT_END