ruby-changes:18470
From: akr <ko1@a...>
Date: Sat, 8 Jan 2011 21:28:42 +0900 (JST)
Subject: [ruby-changes:18470] Ruby:r30493 (trunk): * pack.c (swapf): compilation condition simplified.
akr 2011-01-08 21:25:03 +0900 (Sat, 08 Jan 2011) New Revision: 30493 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30493 Log: * pack.c (swapf): compilation condition simplified. (swapd): ditto. Modified files: trunk/ChangeLog trunk/pack.c Index: ChangeLog =================================================================== --- ChangeLog (revision 30492) +++ ChangeLog (revision 30493) @@ -1,3 +1,8 @@ +Sat Jan 8 21:24:17 2011 Tanaka Akira <akr@f...> + + * pack.c (swapf): compilation condition simplified. + (swapd): ditto. + Sat Jan 8 20:51:25 2011 Tanaka Akira <akr@f...> * pack.c (swapd): remove duplicated code. Index: pack.c =================================================================== --- pack.c (revision 30492) +++ pack.c (revision 30493) @@ -144,23 +144,17 @@ # 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_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 -# 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_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 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/