diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-08 12:25:03 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-08 12:25:03 +0000 |
commit | 8eec9c941348db179c900c896797c78b22d33261 (patch) | |
tree | 44c500c05b2ba7d2fd7d02aeb5d5a70df0f145ea /pack.c | |
parent | 13c4c551d19c63770e94255a1a3a6709ffc487a6 (diff) | |
download | ruby-8eec9c941348db179c900c896797c78b22d33261.tar.gz |
* pack.c (swapf): compilation condition simplified.
(swapd): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r-- | pack.c | 36 |
1 files changed, 13 insertions, 23 deletions
@@ -144,23 +144,17 @@ TOKEN_PASTE(swap,x)(xtype z) \ # endif #endif -#if SIZEOF_FLOAT == 4 -# ifdef HAVE_UINT32_T -# define swapf(x) swap32(x) -# define FLOAT_SWAPPER uint32_t -# else /* SIZEOF_FLOAT == 4 but undivide by known size of int */ - define_swapx(f,float) -# endif -#else /* SIZEOF_FLOAT != 4 */ - define_swapx(f,float) -#endif /* #if SIZEOF_FLOAT == 4 */ - -#if SIZEOF_DOUBLE == 8 -# ifdef HAVE_UINT64_T /* SIZEOF_DOUBLE == 8 == SIZEOF_UINT64_T */ -# define swapd(x) swap64(x) -# define DOUBLE_SWAPPER uint64_t -# else -# if HAVE_INT32_T /* SIZEOF_DOUBLE == 8 && 4 == SIZEOF_INT32 */ +#if SIZEOF_FLOAT == 4 && defined(HAVE_INT32_T) +# define swapf(x) swap32(x) +# define FLOAT_SWAPPER uint32_t +#else + define_swapx(f,float) +#endif + +#if SIZEOF_DOUBLE == 8 && defined(HAVE_INT64_T) +# define swapd(x) swap64(x) +# define DOUBLE_SWAPPER uint64_t +#elif SIZEOF_DOUBLE == 8 && defined(HAVE_INT32_T) static double swapd(const double d) { @@ -176,13 +170,9 @@ TOKEN_PASTE(swap,x)(xtype z) \ memcpy(&dtmp,utmp,sizeof(double)); return dtmp; } -# else /* SIZEOF_DOUBLE == 8 but undivide by known size of int */ +#else define_swapx(d, double) -# endif -# endif /* #if SIZEOF_LONG == 8 */ -#else /* SIZEOF_DOUBLE != 8 */ - define_swapx(d, double) -#endif /* #if SIZEOF_DOUBLE == 8 */ +#endif #undef define_swapx |