From: Nicholas Clark Date: Mon, 6 May 2013 14:54:12 +0000 (+0200) Subject: In pp_pack.c, refactor DO_BO_(UN)?PACK to use my_letohn etc X-Git-Tag: upstream/5.20.0~3452^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=68a0946fb4222dd6bcf5c2881bf6cd64c2c2e5ef;p=platform%2Fupstream%2Fperl.git 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.) --- 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