@@ -52,7 +52,7 @@ typedef std::map<int, Expression> map_int_Expr;
5252// ! `insert(m, first, second)` is equivalent to `m[first] = second`, just faster,
5353// ! because no default constructor is called on the `second` type.
5454template <typename T1 , typename T2 , typename T3 > inline
55- void insert (T1 &m, const T2 &first, const T3 &second) {
55+ void insert (T1 &m, const T2 &first, const T3 &second) {
5656 m.insert (std::pair<T2 , T3 >(first, second));
5757}
5858
@@ -68,10 +68,10 @@ bool umap_eq(const T &a, const T &b)
6868 if (a.size () != b.size ()) return false ;
6969 // Loop over keys in "a":
7070 for (const auto &p: a) {
71- // O(1) lookup of the key in "b":
72- auto f = b.find (p.first );
73- if (f == b.end ()) return false ; // no such element in "b"
74- if (neq (*p.second , *f->second )) return false ; // values not equal
71+ // O(1) lookup of the key in "b":
72+ auto f = b.find (p.first );
73+ if (f == b.end ()) return false ; // no such element in "b"
74+ if (neq (*p.second , *f->second )) return false ; // values not equal
7575 }
7676 return true ;
7777}
@@ -86,8 +86,8 @@ bool map_eq(const T &A, const T &B)
8686 auto a = A.begin ();
8787 auto b = B.begin ();
8888 for (; a != A.end (); ++a, ++b) {
89- if (neq (*a->first , *b->first )) return false ; // keys not equal
90- if (neq (*a->second , *b->second )) return false ; // values not equal
89+ if (neq (*a->first , *b->first )) return false ; // keys not equal
90+ if (neq (*a->second , *b->second )) return false ; // values not equal
9191 }
9292 return true ;
9393}
@@ -112,10 +112,10 @@ int map_compare(const T &A, const T &B)
112112 auto b = B.begin ();
113113 int cmp;
114114 for (; a != A.end (); ++a, ++b) {
115- cmp = a->first ->__cmp__ (*b->first );
116- if (cmp != 0 ) return cmp;
115+ cmp = a->first ->__cmp__ (*b->first );
116+ if (cmp != 0 ) return cmp;
117117 cmp = a->second ->__cmp__ (*b->second );
118- if (cmp != 0 ) return cmp;
118+ if (cmp != 0 ) return cmp;
119119 }
120120 return 0 ;
121121}
@@ -132,11 +132,11 @@ int map_int_Expr_compare(const map_int_Expr &a, const map_int_Expr &b);
132132typedef struct
133133{
134134 inline std::size_t operator () (const vec_int &k) const {
135- std::size_t h = 0 ;
136- for (const auto &p: k) {
137- h = (h << 4 ) + p;
138- }
139- return h;
135+ std::size_t h = 0 ;
136+ for (const auto &p: k) {
137+ h = (h << 4 ) + p;
138+ }
139+ return h;
140140 }
141141} vec_int_hash;
142142
@@ -153,7 +153,7 @@ class vec_uint_hash{
153153 std::size_t operator ()(const vec_uint &v) const {
154154 std::size_t h = 0 ;
155155 for (unsigned int i : v) {
156- h ^= i + 0x9e3779b + (h << 6 ) + (h >> 2 );
156+ h ^= i + 0x9e3779b + (h << 6 ) + (h >> 2 );
157157 }
158158 return h;
159159 }
@@ -163,10 +163,10 @@ class vec_uint_eq{
163163public:
164164 bool operator ()(const vec_uint &a, const vec_uint &b) const {
165165 if (a.size () != b.size ())
166- return false ;
166+ return false ;
167167 for (unsigned int i = 0 ; i < a.size (); i++) {
168- if (a[i] != b[i])
169- return false ;
168+ if (a[i] != b[i])
169+ return false ;
170170 }
171171 return true ;
172172 }
@@ -176,33 +176,34 @@ class vec_uint_compare{
176176public:
177177 bool operator ()(const vec_uint &a, const vec_uint &b) const {
178178 if (a.size () != b.size ())
179- return a.size () < b.size ();
179+ return a.size () < b.size ();
180180 unsigned int sum1 = 0 ;
181181 unsigned int sum2 = 0 ;
182182 for (unsigned int x : a) {
183- sum1 += x;
183+ sum1 += x;
184184 }
185185 for (unsigned int x : b) {
186- sum2 += x;
186+ sum2 += x;
187187 }
188188 if (sum1 != sum2)
189- return sum1 < sum2;
189+ return sum1 < sum2;
190190 return a < b;
191191 }
192192};
193193
194194typedef std::set< RCP <const Symbol>, RCPSymbolCompare> set_sym;
195- typedef std::unordered_map<RCP <const Symbol>, unsigned int , RCPSymbolHash, RCPSymbolEq> umap_sym_uint;
195+ typedef std::unordered_map<RCP <const Symbol>, unsigned int , RCPSymbolHash, RCPSymbolEq>
196+ umap_sym_uint;
196197typedef std::unordered_map<vec_uint, integer_class, vec_uint_hash, vec_uint_eq> umap_uvec_mpz;
197198
198199// Takes an unordered map of type M with key type K and returns a vector of K ordered by C.
199200template <class K , class M , class C >
200- std::vector<K> order_umap (const M &d){
201+ std::vector<K> order_umap (const M &d) {
201202 std::vector<K> v;
202203 for (auto bucket : d) {
203204 auto iter = v.begin ();
204205 while (iter != v.end () && C ()(bucket.first ,*iter)){
205- iter++;
206+ iter++;
206207 }
207208 v.insert (iter, bucket.first );
208209 }
@@ -232,13 +233,13 @@ template<class T>
232233int set_compare (const T &A, const T &B)
233234{
234235 if (A.size () != B.size ())
235- return (A.size () < B.size ()) ? -1 : 1 ;
236+ return (A.size () < B.size ()) ? -1 : 1 ;
236237 auto a = A.begin ();
237238 auto b = B.begin ();
238239 int cmp;
239240 for (; a != A.end (); ++a, ++b) {
240- cmp = (*a)->__cmp__ (**b);
241- if (cmp != 0 ) return cmp;
241+ cmp = (*a)->__cmp__ (**b);
242+ if (cmp != 0 ) return cmp;
242243 }
243244 return 0 ;
244245}
0 commit comments