From 68a0946fb4222dd6bcf5c2881bf6cd64c2c2e5ef Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 6 May 2013 16:54:12 +0200 Subject: [PATCH] In pp_pack.c, refactor DO_BO_(UN)?PACK to use my_letohn etc Previously they were using a my_letoh* function for the appropriate size. This commit probably breaks fixed 16 and 32 bit templates on big endian Crays where sizeof(short) and sizeof(int) are 8. A future commit will restore support. (Although it's not clear whether such Crays can still build blead cleanly, as we've not had any feedback since Boeing decommissioned their Cray.) --- pp_pack.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pp_pack.c b/pp_pack.c index 2967598..8e08c0c 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) { \ - var = my_letoh ## type (var); \ + my_letohn(&var, sizeof(var)); \ } \ } STMT_END # define DO_BO_PACK(var, type) \ STMT_START { \ if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_LITTLE_ENDIAN) { \ - var = my_htole ## type (var); \ + my_htolen(&var, sizeof(var)); \ } \ } STMT_END @@ -286,14 +286,14 @@ S_mul128(pTHX_ SV *sv, U8 m) # define DO_BO_UNPACK(var, type) \ STMT_START { \ if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_BIG_ENDIAN) { \ - var = my_betoh ## type (var); \ + my_betohn(&var, sizeof(var)); \ } \ } STMT_END # define DO_BO_PACK(var, type) \ STMT_START { \ if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_BIG_ENDIAN) { \ - var = my_htobe ## type (var); \ + my_htoben(&var, sizeof(var)); \ } \ } STMT_END -- 2.7.4