diff options
author | Nicholas Clark <nick@ccl4.org> | 2013-05-06 14:40:04 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2013-05-20 21:19:43 +0200 |
commit | 691a44df41bbec11b634fc7bbf78a6eeb1f768a3 (patch) | |
tree | c36b99baa0e5faf7139ef0b22efe36f60d1d24ec /util.c | |
parent | 66bb80e4324617840aa70c8af410bf76eedcbea1 (diff) | |
download | perl-691a44df41bbec11b634fc7bbf78a6eeb1f768a3.tar.gz |
Eliminate the conditionally-compiled fallback functions for htonl etc.
These are now only being used for mixed-endian platforms which do not
provide their own htnol (etc) functions. Given that the fallbacks have been
buggy since they were added in Perl 3.0, it's safe to conclude that no
mixed-endian platforms were ever using these functions.
It's also unclear why these functions were ever marked as 'A', part of the
API. XS code can't call them directly, as it can't rely on them being
compiled. Unsurprisingly, no code on CPAN references them.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 49 |
1 files changed, 0 insertions, 49 deletions
@@ -2160,55 +2160,6 @@ vsprintf(char *dest, const char *pat, void *args) #endif /* HAS_VPRINTF */ -#ifdef MYSWAP -#if BYTEORDER != 0x4321 -short -Perl_my_swap(pTHX_ short s) -{ -#if (BYTEORDER & 1) == 0 - short result; - - result = ((s & 255) << 8) + ((s >> 8) & 255); - return result; -#else - return s; -#endif -} - -long -Perl_my_htonl(pTHX_ long l) -{ - union { - long result; - char c[sizeof(long)]; - } u; - -#if BYTEORDER > 0xFFFF - u.result = 0; -#endif - u.c[0] = (l >> 24) & 255; - u.c[1] = (l >> 16) & 255; - u.c[2] = (l >> 8) & 255; - u.c[3] = l & 255; - return u.result; -} - -long -Perl_my_ntohl(pTHX_ long l) -{ - union { - long l; - char c[sizeof(long)]; - } u; - - u.l = l; - return ((u.c[0] & 255) << 24) | ((u.c[1] & 255) << 16) - | ((u.c[2] & 255) << 8) | (u.c[3] & 255); -} - -#endif /* BYTEORDER != 0x4321 */ -#endif /* MYSWAP */ - /* * Little-endian byte order functions - 'v' for 'VAX', or 'reVerse'. * If these functions are defined, |