From e8fda8c499f46bb801215ff1dbea51c1f3007a6c Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 6 May 2013 18:43:26 +0200 Subject: [PATCH] DO_BO_{UN,}PACK can use my_swabn() directly. This removes the only users of my_{be,le,h}to{be,le,h}n, so remove the definitions for those macros. --- perl.h | 21 --------------------- pp_pack.c | 8 ++++---- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/perl.h b/perl.h index b492f7c..3636147 100644 --- 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 diff --git a/pp_pack.c b/pp_pack.c index 54a7a5c..d85eea2 100644 --- 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 -- 1.8.3.1