mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
13c4c551d1
commit
8eec9c9413
2 changed files with 17 additions and 22 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sat Jan 8 21:24:17 2011 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* pack.c (swapf): compilation condition simplified.
|
||||||
|
(swapd): ditto.
|
||||||
|
|
||||||
Sat Jan 8 20:51:25 2011 Tanaka Akira <akr@fsij.org>
|
Sat Jan 8 20:51:25 2011 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* pack.c (swapd): remove duplicated code.
|
* pack.c (swapd): remove duplicated code.
|
||||||
|
|
34
pack.c
34
pack.c
|
@ -144,23 +144,17 @@ TOKEN_PASTE(swap,x)(xtype z) \
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SIZEOF_FLOAT == 4
|
#if SIZEOF_FLOAT == 4 && defined(HAVE_INT32_T)
|
||||||
# ifdef HAVE_UINT32_T
|
# define swapf(x) swap32(x)
|
||||||
# define swapf(x) swap32(x)
|
# define FLOAT_SWAPPER uint32_t
|
||||||
# define FLOAT_SWAPPER uint32_t
|
#else
|
||||||
# else /* SIZEOF_FLOAT == 4 but undivide by known size of int */
|
define_swapx(f,float)
|
||||||
define_swapx(f,float)
|
#endif
|
||||||
# endif
|
|
||||||
#else /* SIZEOF_FLOAT != 4 */
|
|
||||||
define_swapx(f,float)
|
|
||||||
#endif /* #if SIZEOF_FLOAT == 4 */
|
|
||||||
|
|
||||||
#if SIZEOF_DOUBLE == 8
|
#if SIZEOF_DOUBLE == 8 && defined(HAVE_INT64_T)
|
||||||
# ifdef HAVE_UINT64_T /* SIZEOF_DOUBLE == 8 == SIZEOF_UINT64_T */
|
# define swapd(x) swap64(x)
|
||||||
# define swapd(x) swap64(x)
|
# define DOUBLE_SWAPPER uint64_t
|
||||||
# define DOUBLE_SWAPPER uint64_t
|
#elif SIZEOF_DOUBLE == 8 && defined(HAVE_INT32_T)
|
||||||
# else
|
|
||||||
# if HAVE_INT32_T /* SIZEOF_DOUBLE == 8 && 4 == SIZEOF_INT32 */
|
|
||||||
static double
|
static double
|
||||||
swapd(const double d)
|
swapd(const double d)
|
||||||
{
|
{
|
||||||
|
@ -176,13 +170,9 @@ TOKEN_PASTE(swap,x)(xtype z) \
|
||||||
memcpy(&dtmp,utmp,sizeof(double));
|
memcpy(&dtmp,utmp,sizeof(double));
|
||||||
return dtmp;
|
return dtmp;
|
||||||
}
|
}
|
||||||
# else /* SIZEOF_DOUBLE == 8 but undivide by known size of int */
|
#else
|
||||||
define_swapx(d, double)
|
define_swapx(d, double)
|
||||||
# endif
|
#endif
|
||||||
# endif /* #if SIZEOF_LONG == 8 */
|
|
||||||
#else /* SIZEOF_DOUBLE != 8 */
|
|
||||||
define_swapx(d, double)
|
|
||||||
#endif /* #if SIZEOF_DOUBLE == 8 */
|
|
||||||
|
|
||||||
#undef define_swapx
|
#undef define_swapx
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue