[前][次][番号順一覧][スレッド一覧]

ruby-changes:24064

From: tadf <ko1@a...>
Date: Sat, 16 Jun 2012 19:25:45 +0900 (JST)
Subject: [ruby-changes:24064] tadf:r36115 (trunk): * ext/date/date_core.c: define date_sg_t.

tadf	2012-06-16 19:25:30 +0900 (Sat, 16 Jun 2012)

  New Revision: 36115

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36115

  Log:
    * ext/date/date_core.c: define date_sg_t.

  Modified files:
    trunk/ChangeLog
    trunk/ext/date/date_core.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36114)
+++ ChangeLog	(revision 36115)
@@ -1,3 +1,7 @@
+Sat Jun 16 19:24:01 2012  Tadayoshi Funaba  <tadf@d...>
+
+	* ext/date/date_core.c: define date_sg_t.
+
 Sat Jun 16 18:46:57 2012  Tadayoshi Funaba  <tadf@d...>
 
 	* ext/date/date_tmx.h: offset in struct tmx_funcs is now int.
Index: ext/date/date_core.c
===================================================================
--- ext/date/date_core.c	(revision 36114)
+++ ext/date/date_core.c	(revision 36115)
@@ -218,14 +218,11 @@
 #include <float.h>
 #endif
 
-#if defined(FLT_RADIX) && defined(FLT_MANT_DIG)
-#if FLT_RADIX == 2 && FLT_MANT_DIG > 22
-#define USE_FLOAT
-#define sg_cast float
+#if defined(FLT_RADIX) && defined(FLT_MANT_DIG) && FLT_RADIX == 2 && FLT_MANT_DIG > 22
+#define date_sg_t float
 #else
-#define sg_cast double
+#define date_sg_t double
 #endif
-#endif
 
 /* A set of nth, jd, df and sf denote ajd + 1/2.  Each ajd begin at
  * noon of GMT (assume equal to UTC).  However, this begins at
@@ -240,11 +237,7 @@
     /* df is zero */
     /* sf is zero */
     /* of is zero */
-#ifndef USE_FLOAT
-    double sg;  /* 2298874..2426355 or -/+oo */
-#else
-    float sg;	/* at most 22 bits */
-#endif
+    date_sg_t sg;  /* 2298874..2426355 or -/+oo -- at most 22 bits */
     /* decoded as utc=local */
     int year;	/* truncated */
 #ifndef USE_PACK
@@ -267,11 +260,7 @@
     int df;	/* as utc, in secs */
     VALUE sf;	/* in nano secs */
     int of;	/* in secs */
-#ifndef USE_FLOAT
-    double sg;  /* 2298874..2426355 or -/+oo */
-#else
-    float sg;	/* at most 22 bits */
-#endif
+    date_sg_t sg;  /* 2298874..2426355 or -/+oo -- at most 22 bits */
     /* decoded as local */
     int year;	/* truncated */
 #ifndef USE_PACK
@@ -325,7 +314,7 @@
 {\
     (x)->nth = canon(_nth);\
     (x)->jd = _jd;\
-    (x)->sg = (sg_cast)(_sg);\
+    (x)->sg = (date_sg_t)(_sg);\
     (x)->year = _year;\
     (x)->mon = _mon;\
     (x)->mday = _mday;\
@@ -336,7 +325,7 @@
 {\
     (x)->nth = canon(_nth);\
     (x)->jd = _jd;\
-    (x)->sg = (sg_cast)(_sg);\
+    (x)->sg = (date_sg_t)(_sg);\
     (x)->year = _year;\
     (x)->pc = PACK2(_mon, _mday);\
     (x)->flags = _flags;\
@@ -352,7 +341,7 @@
     (x)->df = _df;\
     (x)->sf = canon(_sf);\
     (x)->of = _of;\
-    (x)->sg = (sg_cast)(_sg);\
+    (x)->sg = (date_sg_t)(_sg);\
     (x)->year = _year;\
     (x)->mon = _mon;\
     (x)->mday = _mday;\
@@ -370,7 +359,7 @@
     (x)->df = _df;\
     (x)->sf = canon(_sf);\
     (x)->of = _of;\
-    (x)->sg = (sg_cast)(_sg);\
+    (x)->sg = (date_sg_t)(_sg);\
     (x)->year = _year;\
     (x)->pc = PACK5(_mon, _mday, _hour, _min, _sec);\
     (x)->flags = _flags;\
@@ -385,7 +374,7 @@
     (x)->df = 0;\
     (x)->sf = INT2FIX(0);\
     (x)->of = 0;\
-    (x)->sg = (sg_cast)((y)->sg);\
+    (x)->sg = (date_sg_t)((y)->sg);\
     (x)->year = (y)->year;\
     (x)->mon = (y)->mon;\
     (x)->mday = (y)->mday;\
@@ -402,7 +391,7 @@
     (x)->df = 0;\
     (x)->sf = INT2FIX(0);\
     (x)->of = 0;\
-    (x)->sg = (sg_cast)((y)->sg);\
+    (x)->sg = (date_sg_t)((y)->sg);\
     (x)->year = (y)->year;\
     (x)->pc = PACK5(EX_MON((y)->pc), EX_MDAY((y)->pc), 0, 0, 0);\
     (x)->flags = (y)->flags;\
@@ -414,7 +403,7 @@
 {\
     (x)->nth = (y)->nth;\
     (x)->jd = (y)->jd;\
-    (x)->sg = (sg_cast)((y)->sg);\
+    (x)->sg = (date_sg_t)((y)->sg);\
     (x)->year = (y)->year;\
     (x)->mon = (y)->mon;\
     (x)->mday = (y)->mday;\
@@ -425,7 +414,7 @@
 {\
     (x)->nth = (y)->nth;\
     (x)->jd = (y)->jd;\
-    (x)->sg = (sg_cast)((y)->sg);\
+    (x)->sg = (date_sg_t)((y)->sg);\
     (x)->year = (y)->year;\
     (x)->pc = PACK2(EX_MON((y)->pc), EX_MDAY((y)->pc));\
     (x)->flags = (y)->flags;\
@@ -5394,12 +5383,12 @@
     if (simple_dat_p(x)) {
 	get_s_jd(x);
 	clear_civil(x);
-	x->s.sg = (sg_cast)sg;
+	x->s.sg = (date_sg_t)sg;
     } else {
 	get_c_jd(x);
 	get_c_df(x);
 	clear_civil(x);
-	x->c.sg = (sg_cast)sg;
+	x->c.sg = (date_sg_t)sg;
     }
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]