# HG changeset patch # User Eli Zaretskii # Date 1218821768 0 # Node ID 1f8e4a26957e70c2fcd775016359e875c65d44fc # Parent bf5ca288ca41813c5890da94d0a3648f1e9aae21 (w32_system_process_attributes) [_MSC_VER < 1300]: Alternative calculation of totphys for Visual Studio 6. diff -r bf5ca288ca41 -r 1f8e4a26957e src/w32.c --- 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;