From 162b0c3bf53a158774adc7ef8d98d462cfffa893 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 10 May 1999 22:56:03 +0000 Subject: [PATCH] MSW compilation fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/longlong.h | 8 +- src/common/longlong.cpp | 4 +- tests/lltest.cpp | 200 ++++++++++++++++++++-------------------- 3 files changed, 107 insertions(+), 105 deletions(-) diff --git a/include/wx/longlong.h b/include/wx/longlong.h index 5f0b712947..3d912f8b62 100644 --- a/include/wx/longlong.h +++ b/include/wx/longlong.h @@ -107,10 +107,10 @@ public: // accessors // get high part long GetHi() const - { return (long)((m_ll & 0xFFFFFFFF00000000ll) >> 32); } + { return (long)((m_ll & 0xFFFFFFFF00000000l) >> 32); } // get low part unsigned long GetLo() const - { return (unsigned long) (m_ll & 0x00000000FFFFFFFFll); } + { return (unsigned long) (m_ll & 0x00000000FFFFFFFFl); } // convert to native long long wxLongLong_t GetValue() const { return m_ll; } @@ -222,7 +222,7 @@ public: void *asArray() const; // input/output - friend std::ostream& operator<<(ostream&, const wxLongLongNative&); + friend ostream& operator<<(ostream&, const wxLongLongNative&); private: wxLongLong_t m_ll; @@ -324,7 +324,7 @@ public: wxLongLongWx& remainder) const; // input/output - friend ostream& operator<<(std::ostream&, const wxLongLongWx&); + friend ostream& operator<<(ostream&, const wxLongLongWx&); private: // long is at least 32 bits, so represent our 64bit number as 2 longs diff --git a/src/common/longlong.cpp b/src/common/longlong.cpp index 4303386f7c..46e5bf98e4 100644 --- a/src/common/longlong.cpp +++ b/src/common/longlong.cpp @@ -56,7 +56,7 @@ void *wxLongLongNative::asArray(void) const } // input/output -std::ostream& operator<< (std::ostream& o, const wxLongLongNative& ll) +ostream& operator<< (ostream& o, const wxLongLongNative& ll) { char result[65]; @@ -449,7 +449,7 @@ void *wxLongLongWx::asArray(void) const // input/output -std::ostream& operator<< (std::ostream& o, const wxLongLongWx& ll) +ostream& operator<< (ostream& o, const wxLongLongWx& ll) { char result[65]; diff --git a/tests/lltest.cpp b/tests/lltest.cpp index 122a148b10..421a363810 100644 --- a/tests/lltest.cpp +++ b/tests/lltest.cpp @@ -1,3 +1,5 @@ +#include "wx/wxprec.h" + #include "wx/longlong.h" #include @@ -7,7 +9,7 @@ #include #endif -static const unsigned long long NumberOfTests = 100000ll; +static const unsigned wxLongLong_t NumberOfTests = 100000l; //using namespace std; int oddbits(unsigned int number); @@ -41,7 +43,7 @@ int shifttest(); int shifttest() { - std::cout << std::endl << "Starting shift tests." << endl; + cout << endl << "Starting shift tests." << endl; long hi = 0; unsigned long lo = 0; @@ -52,7 +54,7 @@ int shifttest() { if ((counter % 1000) == 999) { - std::cerr << "+"; + cerr << "+"; #if defined(__MWERKS__) && macintosh GetNextEvent(0, NULL); #endif @@ -91,24 +93,24 @@ int shifttest() if ((memcmp(oneb, twob, 8) != 0) || (memcmp(onec, twoc, 8) != 0) || (memcmp(oneb, onec, 8) != 0)) { - std::cout << std::endl << "After " << counter << " successful trials: " << std::endl; - std::cout << l1a << std::endl; - std::cout << l2a << std::endl; + cout << endl << "After " << wxLongLongNative(counter) << " successful trials: " << endl; + cout << l1a << endl; + cout << l2a << endl; if (leftshift) - std::cout << "<< "; + cout << "<< "; else - std::cout << ">> "; - std::cout << shift << std::endl; - std::cout << l1b << std::endl; - std::cout << l2b << std::endl; - std::cout << l1c << std::endl; - std::cout << l2c << std::endl; + cout << ">> "; + cout << shift << endl; + cout << l1b << endl; + cout << l2b << endl; + cout << l1c << endl; + cout << l2c << endl; return 0; } counter++; } - std::cout << std::endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << std::endl; + cout << endl << wxLongLongNative(counter) << " successful trial" << (counter == 1 ? "." : "s.") << endl; return 1; } @@ -117,7 +119,7 @@ int add1test(); int add1test() { - std::cout << std::endl << "Starting first addition tests." << endl; + cout << endl << "Starting first addition tests." << endl; long hi = 0; unsigned long lo = 0; @@ -128,7 +130,7 @@ int add1test() { if ((counter % 1000) == 999) { - std::cerr << "+"; + cerr << "+"; #if defined(__MWERKS__) && macintosh GetNextEvent(0, NULL); #endif @@ -157,19 +159,19 @@ int add1test() if ((memcmp(onec, twoc, 8) != 0) || (memcmp(oned, twod, 8) != 0) || (memcmp(onec, oned, 8) != 0)) { - std::cout << std::endl << "After " << counter << " successful trials: " << std::endl; - std::cout << l1a << std::endl; - std::cout << l2a << std::endl; - std::cout << l1b << std::endl; - std::cout << l2b << std::endl; - std::cout << l1c << std::endl; - std::cout << l2c << std::endl; + cout << endl << "After " << wxLongLongNative(counter) << " successful trials: " << endl; + cout << l1a << endl; + cout << l2a << endl; + cout << l1b << endl; + cout << l2b << endl; + cout << l1c << endl; + cout << l2c << endl; return 0; } counter++; } - std::cout << std::endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << std::endl; + cout << endl << wxLongLongNative(counter) << " successful trial" << (counter == 1 ? "." : "s.") << endl; return 1; } @@ -179,7 +181,7 @@ int add2test(); int add2test() { - std::cout << std::endl << "Starting second addition tests." << endl; + cout << endl << "Starting second addition tests." << endl; long hi = 0; unsigned long lo = 0; @@ -190,7 +192,7 @@ int add2test() { if ((counter % 1000) == 999) { - std::cerr << "+"; + cerr << "+"; #if defined(__MWERKS__) && macintosh GetNextEvent(0, NULL); #endif @@ -213,19 +215,19 @@ int add2test() if (memcmp(one, two, 8) != 0) { - std::cout << std::endl << "After " << counter << " successful trials: " << std::endl; - std::cout << l1c << std::endl; - std::cout << l2c << std::endl; - std::cout << l1a << std::endl; - std::cout << l2a << std::endl; - std::cout << l1b << std::endl; - std::cout << l2b << std::endl; + cout << endl << "After " << counter << " successful trials: " << endl; + cout << l1c << endl; + cout << l2c << endl; + cout << l1a << endl; + cout << l2a << endl; + cout << l1b << endl; + cout << l2b << endl; return 0; } counter++; } - std::cout << std::endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << std::endl; + cout << endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << endl; return 1; } @@ -235,7 +237,7 @@ int sub1test(); int sub1test() { - std::cout << std::endl << "Starting first subtraction tests." << endl; + cout << endl << "Starting first subtraction tests." << endl; long hi = 0; unsigned long lo = 0; @@ -246,7 +248,7 @@ int sub1test() { if ((counter % 1000) == 999) { - std::cerr << "+"; + cerr << "+"; #if defined(__MWERKS__) && macintosh GetNextEvent(0, NULL); #endif @@ -275,21 +277,21 @@ int sub1test() if ((memcmp(onec, twoc, 8) != 0) || (memcmp(oned, twod, 8) != 0) || (memcmp(onec, oned, 8) != 0)) { - std::cout << std::endl << "After " << counter << " successful trials: " << std::endl; - std::cout << l1a << std::endl; - std::cout << l2a << std::endl; - std::cout << l1b << std::endl; - std::cout << l2b << std::endl; - std::cout << l1c << std::endl; - std::cout << l2c << std::endl; - std::cout << l1d << std::endl; - std::cout << l2d << std::endl; + cout << endl << "After " << wxLongLongNative(counter) << " successful trials: " << endl; + cout << l1a << endl; + cout << l2a << endl; + cout << l1b << endl; + cout << l2b << endl; + cout << l1c << endl; + cout << l2c << endl; + cout << l1d << endl; + cout << l2d << endl; return 0; } counter++; } - std::cout << std::endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << std::endl; + cout << endl << wxLongLongNative(counter) << " successful trial" << (counter == 1 ? "." : "s.") << endl; return 1; } @@ -299,7 +301,7 @@ int sub2test(); int sub2test() { - std::cout << std::endl << "Starting second subtraction tests." << endl; + cout << endl << "Starting second subtraction tests." << endl; long hi = 0; unsigned long lo = 0; @@ -310,7 +312,7 @@ int sub2test() { if ((counter % 1000) == 999) { - std::cerr << "+"; + cerr << "+"; #if defined(__MWERKS__) && macintosh GetNextEvent(0, NULL); #endif @@ -333,19 +335,19 @@ int sub2test() if (memcmp(one, two, 8) != 0) { - std::cout << std::endl << "After " << counter << " successful trials: " << std::endl; - std::cout << l1c << std::endl; - std::cout << l2c << std::endl; - std::cout << l1a << std::endl; - std::cout << l2a << std::endl; - std::cout << l1b << std::endl; - std::cout << l2b << std::endl; + cout << endl << "After " << counter << " successful trials: " << endl; + cout << l1c << endl; + cout << l2c << endl; + cout << l1a << endl; + cout << l2a << endl; + cout << l1b << endl; + cout << l2b << endl; return 0; } counter++; } - std::cout << std::endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << std::endl; + cout << endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << endl; return 1; } @@ -356,7 +358,7 @@ int incdectest(); int incdectest() { - std::cout << std::endl << "Starting pre/post increment/decrement tests." << endl; + cout << endl << "Starting pre/post increment/decrement tests." << endl; long hi = 0; unsigned long lo = 0; @@ -367,7 +369,7 @@ int incdectest() { if ((counter % 1000) == 999) { - std::cerr << "+"; + cerr << "+"; #if defined(__MWERKS__) && macintosh GetNextEvent(0, NULL); #endif @@ -410,18 +412,18 @@ int incdectest() if (memcmp(one, two, 8) != 0) { - std::cout << std::endl << "After " << counter << " successful trials: " << std::endl; - std::cout << l1a << std::endl; - std::cout << l2a << std::endl; - std::cout << (pre ? "pre" : "post") << (increment ? "increment" : "decrement") << std::endl; - std::cout << l1b << std::endl; - std::cout << l2b << std::endl; + cout << endl << "After " << wxLongLongNative(counter) << " successful trials: " << endl; + cout << l1a << endl; + cout << l2a << endl; + cout << (pre ? "pre" : "post") << (increment ? "increment" : "decrement") << endl; + cout << l1b << endl; + cout << l2b << endl; return 0; } counter++; } - std::cout << std::endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << std::endl; + cout << endl << wxLongLongNative(counter) << " successful trial" << (counter == 1 ? "." : "s.") << endl; return 1; } @@ -430,7 +432,7 @@ int negationtest(); int negationtest() { - std::cout << std::endl << "Starting negation tests." << endl; + cout << endl << "Starting negation tests." << endl; long hi = 0; unsigned long lo = 0; @@ -441,7 +443,7 @@ int negationtest() { if ((counter % 1000) == 999) { - std::cerr << "+"; + cerr << "+"; #if defined(__MWERKS__) && macintosh GetNextEvent(0, NULL); #endif @@ -458,17 +460,17 @@ int negationtest() if (memcmp(one, two, 8) != 0) { - std::cout << std::endl << "After " << counter << " successful trials: " << std::endl; - std::cout << l1a << std::endl; - std::cout << l2a << std::endl; - std::cout << l1b << std::endl; - std::cout << l2b << std::endl; + cout << endl << "After " << wxLongLongNative(counter) << " successful trials: " << endl; + cout << l1a << endl; + cout << l2a << endl; + cout << l1b << endl; + cout << l2b << endl; return 0; } counter++; } - std::cout << std::endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << std::endl; + cout << endl << wxLongLongNative(counter) << " successful trial" << (counter == 1 ? "." : "s.") << endl; return 1; } @@ -477,7 +479,7 @@ int multiplicationtest(); int multiplicationtest() { - std::cout << std::endl << "Starting multiplication tests." << endl; + cout << endl << "Starting multiplication tests." << endl; long hi = 0; unsigned long lo = 0; @@ -488,7 +490,7 @@ int multiplicationtest() { if ((counter % 1000) == 999) { - std::cerr << "+"; + cerr << "+"; #if defined(__MWERKS__) && macintosh GetNextEvent(0, NULL); #endif @@ -516,21 +518,21 @@ int multiplicationtest() if ((memcmp(onec, twoc, 8) != 0) || (memcmp(oned, twod, 8) != 0) || (memcmp(onec, oned, 8) != 0)) { - std::cout << std::endl << "After " << counter << " successful trials: " << std::endl; - std::cout << l1a << std::endl; - std::cout << l2a << std::endl; - std::cout << l1b << std::endl; - std::cout << l2b << std::endl; - std::cout << l1c << std::endl; - std::cout << l2c << std::endl; - std::cout << l1d << std::endl; - std::cout << l2d << std::endl; + cout << endl << "After " << wxLongLongNative(counter) << " successful trials: " << endl; + cout << l1a << endl; + cout << l2a << endl; + cout << l1b << endl; + cout << l2b << endl; + cout << l1c << endl; + cout << l2c << endl; + cout << l1d << endl; + cout << l2d << endl; return 0; } counter++; } - std::cout << std::endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << std::endl; + cout << endl << wxLongLongNative(counter) << " successful trial" << (counter == 1 ? "." : "s.") << endl; return 1; } @@ -539,7 +541,7 @@ int bitwisetest(); int bitwisetest() { - std::cout << std::endl << "Starting bitwise tests." << endl; + cout << endl << "Starting bitwise tests." << endl; long hi = 0; unsigned long lo = 0; @@ -550,7 +552,7 @@ int bitwisetest() { if ((counter % 1000) == 999) { - std::cerr << "+"; + cerr << "+"; #if defined(__MWERKS__) && macintosh GetNextEvent(0, NULL); #endif @@ -578,21 +580,21 @@ int bitwisetest() if ((memcmp(onec, twoc, 8) != 0) || (memcmp(oned, twod, 8) != 0) || (memcmp(onec, oned, 8) != 0)) { - std::cout << std::endl << "After " << counter << " successful trials: " << std::endl; - std::cout << l1a << std::endl; - std::cout << l2a << std::endl; - std::cout << l1b << std::endl; - std::cout << l2b << std::endl; - std::cout << l1c << std::endl; - std::cout << l2c << std::endl; - std::cout << l1d << std::endl; - std::cout << l2d << std::endl; + cout << endl << "After " << wxLongLongNative(counter) << " successful trials: " << endl; + cout << l1a << endl; + cout << l2a << endl; + cout << l1b << endl; + cout << l2b << endl; + cout << l1c << endl; + cout << l2c << endl; + cout << l1d << endl; + cout << l2d << endl; return 0; } counter++; } - std::cout << std::endl << counter << " successful trial" << (counter == 1 ? "." : "s.") << std::endl; + cout << endl << wxLongLongNative(counter) << " successful trial" << (counter == 1 ? "." : "s.") << endl; return 1; } @@ -605,7 +607,7 @@ int main() SIOUXSettings.autocloseonquit = 0; #endif - std::cout << "Starting tests." << endl; + cout << "Starting tests." << endl; #if defined(__MWERKS__) && macintosh GetNextEvent(0, NULL); @@ -637,7 +639,7 @@ int main() if (!negationtest()) return 1; - std::cout << std::endl << "The tests are finished." << std::endl; + cout << endl << "The tests are finished." << endl; return 0; } -- 2.45.2