]> www.ginac.de Git - ginac.git/blob - ginac/utils.cpp
69d4f46110dc43e5a50f717d82bb1d834334c20d
[ginac.git] / ginac / utils.cpp
1 /** @file utils.cpp
2  *
3  *  Implementation of several small and furry utilities.
4  *
5  *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 unsigned log2(unsigned n)
23 {
24     unsigned k;
25     for (k = 0; n > 1; n >>= 1) ++k;
26     return k;
27 }
28
29 int compare_pointers(void const * a, void const * b)
30 {
31     if (a<b) {
32         return -1;
33     } else if (a>b) {
34         return 1;
35     }
36     return 0;
37 }
38
39 // comment skeletton for header files
40
41
42 // member functions
43
44     // default constructor, destructor, copy constructor assignment operator and helpers
45     // none
46
47     // other constructors
48     // none
49
50     // functions overriding virtual functions from bases classes
51     // none
52     
53     // new virtual functions which can be overridden by derived classes
54     // none
55
56     // non-virtual functions in this class
57     // none
58
59 // member variables
60 // none
61     
62
63
64 // comment skeletton for implementation files
65
66
67 //////////
68 // default constructor, destructor, copy constructor assignment operator and helpers
69 //////////
70
71 // public
72 // protected
73
74 //////////
75 // other constructors
76 //////////
77
78 // public
79 // none
80
81 //////////
82 // functions overriding virtual functions from bases classes
83 //////////
84
85 // public
86 // protected
87 // none
88
89 //////////
90 // new virtual functions which can be overridden by derived classes
91 //////////
92
93 // public
94 // protected
95 // none
96
97 //////////
98 // non-virtual functions in this class
99 //////////
100
101 // public
102 // protected
103 // none
104
105 //////////
106 // static member variables
107 //////////
108
109 // protected
110 // private
111 // none
112
113
114
115