Advanced Strategic Command
misc.h
Go to the documentation of this file.
1 
5 /*
6  This file is part of Advanced Strategic Command; http://www.asc-hq.de
7  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; see the file COPYING. If not, write to the
21  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22  Boston, MA 02111-1307 USA
23 */
24 
25 
26 
27 #ifndef miscH
28  #define miscH
29 
30  #include "global.h"
31  #include <string>
32 
33  #define dblue lightgray
34  //153
35 
36 
38  extern int getFirstBit(int i);
39 
40 
41  extern const char* digit[] ;
42  extern const char* letter[] ;
43 
47  extern char* strrr ( int a ) ;
48  // extern char* strrr ( Uint32 a );
49 
53  extern char* strrr ( double a ) ;
54 
55  extern int crc32buf( const void *vbuf, int len);
56 
57  extern int atoi ( const std::string& s );
58  extern double atof ( const std::string& s );
59 
60 #ifdef min
61 #undef min
62 #endif
63 
64 #ifdef max
65 #undef max
66 #endif
67 
68 /*
69 template<typename T>
70 T min ( T a, T b )
71 {
72  if ( a > b )
73  return b;
74  else
75  return a;
76 }
77 */
78 
79 template<typename T>
80 const T& min ( const T& a, const T& b, const T& c )
81 {
82  return min ( a, min ( b, c ));
83 }
84 
85 /*
86 template<typename T>
87 T max ( T a, T b )
88 {
89  if ( a > b )
90  return a;
91  else
92  return b;
93 }
94 */
95 
96 template<typename T>
97 const T& max ( const T& a, const T& b, const T& c )
98 {
99  return max ( a, max ( b, c ));
100 }
101 
102 
103  extern char *strupr (const char *a);
104 
105  #ifndef HAVE_ITOA
106  extern char* itoa ( int a, char* b, int c);
107  #endif
108 
109 #endif
double atof(const std::string &s)
Definition: misc.cpp:157
const char * digit[]
Definition: misc.cpp:37
int crc32buf(const void *vbuf, int len)
Definition: misc.cpp:135
char * strrr(int a)
converts a to a string.
Definition: misc.cpp:66
Global platform dependant definitions. This file just branches to the platform specific files in thei...
const char * letter[]
Definition: misc.cpp:38
char * strupr(const char *a)
Definition: misc.cpp:164
const T & max(const T &a, const T &b, const T &c)
Definition: misc.h:97
const T & min(const T &a, const T &b, const T &c)
Definition: misc.h:80
int atoi(const std::string &s)
Definition: misc.cpp:152
char * itoa(int a, char *b, int c)
Definition: misc.cpp:179
int getFirstBit(int i)
Count the number of zero bits on the LSB side of "zahl".
Definition: misc.cpp:45