This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix primitive wi::int_traits


The following patch fixes completes the primitive int_traints
with long and long long variants and drops the HWI case.  This
fixes darwin builds where HOST_WIDE_INT is 'long' but
int64_t is 'long long'.

Bootstrapped on x86_64-unknown-linux-gnu (and on darwin by Ian),
soon to be committed.

Richard.

2014-05-26  Richard Biener  <rguenther@suse.de>

	* wide-int.h (wi::int_traits <long>, wi::int_traits <unsigned long>,
	wi::int_traits <long long>, wi::int_traits <unsigned long long>):
	Provide specializations.
	(wi::int_traits <HOST_WIDE_INT>,
	wi::int_traits <unsigned HOST_WIDE_INT>): Remove specializations.

Index: gcc/wide-int.h
===================================================================
--- gcc/wide-int.h	(revision 210931)
+++ gcc/wide-int.h	(working copy)
@@ -1446,12 +1446,22 @@ namespace wi
     : public primitive_int_traits <unsigned int, false> {};
 
   template <>
-  struct int_traits <HOST_WIDE_INT>
-    : public primitive_int_traits <HOST_WIDE_INT, true> {};
+  struct int_traits <long>
+    : public primitive_int_traits <long, true> {};
 
   template <>
-  struct int_traits <unsigned HOST_WIDE_INT>
-    : public primitive_int_traits <unsigned HOST_WIDE_INT, false> {};
+  struct int_traits <unsigned long>
+    : public primitive_int_traits <unsigned long, false> {};
+
+#if defined HAVE_LONG_LONG
+  template <>
+  struct int_traits <long long>
+    : public primitive_int_traits <long long, true> {};
+
+  template <>
+  struct int_traits <unsigned long long>
+    : public primitive_int_traits <unsigned long long, false> {};
+#endif
 }
 
 namespace wi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]