summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-05-06 16:36:09 +0200
committerNicholas Clark <nick@ccl4.org>2013-05-20 21:19:43 +0200
commit86c6fce076648c5abe5ab491fec9d3142d93bde1 (patch)
treeeed5c6ef76ff8f1cf9a83ae4bd0068fe088bccd7 /pp_pack.c
parentdf609c5f9dbf07fc7a18075911f5eaefdeea3ffd (diff)
downloadperl-86c6fce076648c5abe5ab491fec9d3142d93bde1.tar.gz
In pp_pack.c, refactor DO_BO_(UN)?PACK_PTR to use my_letohn etc
Previously they were casting the pointer to an integer value, calling a my_letoh* function for the appropriate size, and casting the return value back to a pointer.
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pp_pack.c b/pp_pack.c
index 8a59e69307..2967598f4d 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -256,14 +256,14 @@ S_mul128(pTHX_ SV *sv, U8 m)
# define DO_BO_UNPACK_PTR(var, type, pre_cast, post_cast) \
STMT_START { \
if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_LITTLE_ENDIAN) { \
- var = (post_cast *) my_letoh ## type ((pre_cast) var); \
+ my_letohn(&var, sizeof(var)); \
} \
} STMT_END
# define DO_BO_PACK_PTR(var, type, pre_cast, post_cast) \
STMT_START { \
if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_LITTLE_ENDIAN) { \
- var = (post_cast *) my_htole ## type ((pre_cast) var); \
+ my_htolen(&var, sizeof(var)); \
} \
} STMT_END
@@ -300,14 +300,14 @@ S_mul128(pTHX_ SV *sv, U8 m)
# define DO_BO_UNPACK_PTR(var, type, pre_cast, post_cast) \
STMT_START { \
if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_BIG_ENDIAN) { \
- var = (post_cast *) my_betoh ## type ((pre_cast) var); \
+ my_betohn(&var, sizeof(var)); \
} \
} STMT_END
# define DO_BO_PACK_PTR(var, type, pre_cast, post_cast) \
STMT_START { \
if (TYPE_ENDIANNESS(datumtype) == TYPE_IS_BIG_ENDIAN) { \
- var = (post_cast *) my_htobe ## type ((pre_cast) var); \
+ my_htoben(&var, sizeof(var)); \
} \
} STMT_END