changeset 97495:1f8e4a26957e

(w32_system_process_attributes) [_MSC_VER < 1300]: Alternative calculation of totphys for Visual Studio 6.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 15 Aug 2008 17:36:08 +0000
parents bf5ca288ca41
children 9c943d4f3c98
files src/w32.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32.c	Fri Aug 15 17:08:58 2008 +0000
+++ b/src/w32.c	Fri Aug 15 17:36:08 2008 +0000
@@ -3992,7 +3992,19 @@
 		 attrs);
 
   if (global_memory_status_ex (&memstex))
+#if __GNUC__ || (defined (_MSC_VER) && _MSC_VER >= 1300)
     totphys = memstex.ullTotalPhys / 1024.0;
+#else
+  /* Visual Studio 6 cannot convert an unsigned __int64 type to
+     double, so we need to do this for it...  */
+    {
+      DWORD tot_hi = memstex.ullTotalPhys >> 32;
+      DWORD tot_md = (memstex.ullTotalPhys & 0x00000000ffffffff) >> 10;
+      DWORD tot_lo = memstex.ullTotalPhys % 1024;
+
+      totphys = tot_hi * 4194304.0 + tot_md + tot_lo / 1024.0;
+    }
+#endif	/* __GNUC__ || _MSC_VER >= 1300 */
   else if (global_memory_status (&memst))
     totphys = memst.dwTotalPhys / 1024.0;