diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2012-08-28 17:42:54 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2012-08-28 17:42:54 +0000 |
| commit | 411cdf39fc2b961a970a0ae91b9059614251247e (patch) | |
| tree | 935afa56c11aef0fb769e63659970e7d033a99e8 /src/stable/util.h | |
| parent | fc5132d68ae9e6afdbd0b5a687ba81c88fc84826 (diff) | |
| download | libbu++-411cdf39fc2b961a970a0ae91b9059614251247e.tar.gz libbu++-411cdf39fc2b961a970a0ae91b9059614251247e.tar.bz2 libbu++-411cdf39fc2b961a970a0ae91b9059614251247e.tar.xz libbu++-411cdf39fc2b961a970a0ae91b9059614251247e.zip | |
Loads of win32 compilation issues fixed. Most are fairly minor unsigned/signed
mismatches because of socket handles, but there were also some
order-of-definition issues that were fixed in the FD_SETSIZE definition code.
Fixed a few things that just never worked on windows, like Bu::Thread::yield().
Diffstat (limited to '')
| -rw-r--r-- | src/stable/util.h | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/stable/util.h b/src/stable/util.h index 087af6e..4514281 100644 --- a/src/stable/util.h +++ b/src/stable/util.h | |||
| @@ -39,11 +39,6 @@ namespace Bu | |||
| 39 | b = tmp; | 39 | b = tmp; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | #ifdef WIN32 | ||
| 43 | #warning: removing min and max win32 macros because of compile conflict | ||
| 44 | #undef min | ||
| 45 | #undef max | ||
| 46 | #endif | ||
| 47 | /** | 42 | /** |
| 48 | * Finds the lesser of the two objects, objects passed in must be | 43 | * Finds the lesser of the two objects, objects passed in must be |
| 49 | * less-than-comparable. | 44 | * less-than-comparable. |
| @@ -52,7 +47,7 @@ namespace Bu | |||
| 52 | *@returns A reference to the lesser of a or b. | 47 | *@returns A reference to the lesser of a or b. |
| 53 | */ | 48 | */ |
| 54 | template<typename item> | 49 | template<typename item> |
| 55 | const item &min( const item &a, const item &b ) | 50 | const item &buMin( const item &a, const item &b ) |
| 56 | { | 51 | { |
| 57 | return a<b?a:b; | 52 | return a<b?a:b; |
| 58 | } | 53 | } |
| @@ -65,7 +60,7 @@ namespace Bu | |||
| 65 | *@returns A reference to the lesser of a or b. | 60 | *@returns A reference to the lesser of a or b. |
| 66 | */ | 61 | */ |
| 67 | template<typename item> | 62 | template<typename item> |
| 68 | item &min( item &a, item &b ) | 63 | item &buMin( item &a, item &b ) |
| 69 | { | 64 | { |
| 70 | return a<b?a:b; | 65 | return a<b?a:b; |
| 71 | } | 66 | } |
| @@ -78,7 +73,7 @@ namespace Bu | |||
| 78 | *@returns A reference to the greater of a or b. | 73 | *@returns A reference to the greater of a or b. |
| 79 | */ | 74 | */ |
| 80 | template<typename item> | 75 | template<typename item> |
| 81 | const item &max( const item &a, const item &b ) | 76 | const item &buMax( const item &a, const item &b ) |
| 82 | { | 77 | { |
| 83 | return b<a?a:b; | 78 | return b<a?a:b; |
| 84 | } | 79 | } |
| @@ -91,7 +86,7 @@ namespace Bu | |||
| 91 | *@returns A reference to the greater of a or b. | 86 | *@returns A reference to the greater of a or b. |
| 92 | */ | 87 | */ |
| 93 | template<typename item> | 88 | template<typename item> |
| 94 | item &max( item &a, item &b ) | 89 | item &buMax( item &a, item &b ) |
| 95 | { | 90 | { |
| 96 | return b<a?a:b; | 91 | return b<a?a:b; |
| 97 | } | 92 | } |
| @@ -104,9 +99,9 @@ namespace Bu | |||
| 104 | *@returns A reference to the mid-value of a, b, and c. | 99 | *@returns A reference to the mid-value of a, b, and c. |
| 105 | */ | 100 | */ |
| 106 | template<typename item> | 101 | template<typename item> |
| 107 | const item &mid( const item &a, const item &b, const item &c ) | 102 | const item &buMid( const item &a, const item &b, const item &c ) |
| 108 | { | 103 | { |
| 109 | return min( max( a, b ), c ); | 104 | return buMin( buMax( a, b ), c ); |
| 110 | } | 105 | } |
| 111 | 106 | ||
| 112 | /** | 107 | /** |
| @@ -117,9 +112,9 @@ namespace Bu | |||
| 117 | *@returns A reference to the mid-value of a, b, and c. | 112 | *@returns A reference to the mid-value of a, b, and c. |
| 118 | */ | 113 | */ |
| 119 | template<typename item> | 114 | template<typename item> |
| 120 | item &mid( item &a, item &b, item &c ) | 115 | item &buMid( item &a, item &b, item &c ) |
| 121 | { | 116 | { |
| 122 | return min( max( a, b ), c ); | 117 | return buMin( buMax( a, b ), c ); |
| 123 | } | 118 | } |
| 124 | 119 | ||
| 125 | // | 120 | // |
