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