summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2008-08-15 17:36:48 +0000
committerEli Zaretskii <eliz@gnu.org>2008-08-15 17:36:48 +0000
commit235661f6d5ee8034271d01e21d279eb35aeba3ca (patch)
treeeca0846d5710d5d5f15409f81aa72d3e7f0f0e59 /src
parent8e764ce06db3cfc2dc84c0e81c276715a332fe21 (diff)
downloademacs-235661f6d5ee8034271d01e21d279eb35aeba3ca.tar.gz
(w32_system_process_attributes) [_MSC_VER < 1300]: Alternative calculation
of totphys for Visual Studio 6.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/w32.c12
2 files changed, 15 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d7f5b59387d..42a0cabbafc 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
2008-08-15 Eli Zaretskii <eliz@gnu.org>
+ * w32.c (w32_system_process_attributes) [_MSC_VER < 1300]:
+ Alternative calculation of totphys for Visual Studio 6.
+
* w32fns.c [_MSC_VER && _MSC_VER < 1300]: Declare HMONITOR.
* w32.c (_MEMORY_STATUS_EX, MEMORY_STATUS_EX, LPMEMORY_STATUS_EX):
diff --git a/src/w32.c b/src/w32.c
index 483375dc0df..c7af7f06340 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -3992,7 +3992,19 @@ w32_system_process_attributes (pid)
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;