summaryrefslogtreecommitdiff
path: root/src/tool/moneycount/portability_fixes.cpp
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2010-06-21 13:12:27 -0400
committerChuck Miller <shadowmil@gmail.com>2010-06-21 13:16:56 -0400
commit3697be69b0dffc185c9b4cf8221c782f48546771 (patch)
treed7446a76f046de6d1e1d0239ebccf9d4ba8f5b39 /src/tool/moneycount/portability_fixes.cpp
parent14655f336082a85eaafaae8f54f9a5d9a2c6f061 (diff)
downloadtmwa-3697be69b0dffc185c9b4cf8221c782f48546771.tar.gz
tmwa-3697be69b0dffc185c9b4cf8221c782f48546771.tar.bz2
tmwa-3697be69b0dffc185c9b4cf8221c782f48546771.tar.xz
tmwa-3697be69b0dffc185c9b4cf8221c782f48546771.zip
Use the stlplus::inf class in the money count to avoid overflow
Also changed the degree of freedom to 0
Diffstat (limited to 'src/tool/moneycount/portability_fixes.cpp')
-rw-r--r--src/tool/moneycount/portability_fixes.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/tool/moneycount/portability_fixes.cpp b/src/tool/moneycount/portability_fixes.cpp
new file mode 100644
index 0000000..e26ee28
--- /dev/null
+++ b/src/tool/moneycount/portability_fixes.cpp
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+
+// Author: Andy Rushton
+// Copyright: (c) Southampton University 1999-2004
+// (c) Andy Rushton 2004-2009
+// License: BSD License, see ../docs/license.html
+
+////////////////////////////////////////////////////////////////////////////////
+#include "portability_fixes.hpp"
+
+#ifdef MSWINDOWS
+#include "windows.h"
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+// problems with missing functions
+////////////////////////////////////////////////////////////////////////////////
+
+#ifdef MSWINDOWS
+unsigned sleep(unsigned seconds)
+{
+ Sleep(1000*seconds);
+ // should return remaining time if interrupted - however Windoze Sleep cannot be interrupted
+ return 0;
+}
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+// Function for establishing endian-ness
+////////////////////////////////////////////////////////////////////////////////
+
+bool stlplus::little_endian(void)
+{
+ int sample = 1;
+ char* sample_bytes = (char*)&sample;
+ return sample_bytes[0] != 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////