12
12
#include " llvm/Support/raw_ostream.h"
13
13
14
14
using namespace llvm ;
15
- using namespace detail ;
15
+ using namespace llvm :: detail;
16
16
17
17
SlowDynamicAPInt::SlowDynamicAPInt (int64_t Val)
18
18
: Val(64 , Val, /* isSigned=*/ true ) {}
@@ -23,94 +23,94 @@ SlowDynamicAPInt &SlowDynamicAPInt::operator=(int64_t Val) {
23
23
}
24
24
SlowDynamicAPInt::operator int64_t () const { return Val.getSExtValue (); }
25
25
26
- hash_code detail::hash_value (const SlowDynamicAPInt &X) {
26
+ hash_code llvm:: detail::hash_value (const SlowDynamicAPInt &X) {
27
27
return hash_value (X.Val );
28
28
}
29
29
30
30
// / ---------------------------------------------------------------------------
31
31
// / Convenience operator overloads for int64_t.
32
32
// / ---------------------------------------------------------------------------
33
- SlowDynamicAPInt &detail::operator +=(SlowDynamicAPInt &A, int64_t B) {
33
+ SlowDynamicAPInt &llvm:: detail::operator +=(SlowDynamicAPInt &A, int64_t B) {
34
34
return A += SlowDynamicAPInt (B);
35
35
}
36
- SlowDynamicAPInt &detail::operator -=(SlowDynamicAPInt &A, int64_t B) {
36
+ SlowDynamicAPInt &llvm:: detail::operator -=(SlowDynamicAPInt &A, int64_t B) {
37
37
return A -= SlowDynamicAPInt (B);
38
38
}
39
- SlowDynamicAPInt &detail::operator *=(SlowDynamicAPInt &A, int64_t B) {
39
+ SlowDynamicAPInt &llvm:: detail::operator *=(SlowDynamicAPInt &A, int64_t B) {
40
40
return A *= SlowDynamicAPInt (B);
41
41
}
42
- SlowDynamicAPInt &detail::operator /=(SlowDynamicAPInt &A, int64_t B) {
42
+ SlowDynamicAPInt &llvm:: detail::operator /=(SlowDynamicAPInt &A, int64_t B) {
43
43
return A /= SlowDynamicAPInt (B);
44
44
}
45
- SlowDynamicAPInt &detail::operator %=(SlowDynamicAPInt &A, int64_t B) {
45
+ SlowDynamicAPInt &llvm:: detail::operator %=(SlowDynamicAPInt &A, int64_t B) {
46
46
return A %= SlowDynamicAPInt (B);
47
47
}
48
48
49
- bool detail::operator ==(const SlowDynamicAPInt &A, int64_t B) {
49
+ bool llvm:: detail::operator ==(const SlowDynamicAPInt &A, int64_t B) {
50
50
return A == SlowDynamicAPInt (B);
51
51
}
52
- bool detail::operator !=(const SlowDynamicAPInt &A, int64_t B) {
52
+ bool llvm:: detail::operator !=(const SlowDynamicAPInt &A, int64_t B) {
53
53
return A != SlowDynamicAPInt (B);
54
54
}
55
- bool detail::operator >(const SlowDynamicAPInt &A, int64_t B) {
55
+ bool llvm:: detail::operator >(const SlowDynamicAPInt &A, int64_t B) {
56
56
return A > SlowDynamicAPInt (B);
57
57
}
58
- bool detail::operator <(const SlowDynamicAPInt &A, int64_t B) {
58
+ bool llvm:: detail::operator <(const SlowDynamicAPInt &A, int64_t B) {
59
59
return A < SlowDynamicAPInt (B);
60
60
}
61
- bool detail::operator <=(const SlowDynamicAPInt &A, int64_t B) {
61
+ bool llvm:: detail::operator <=(const SlowDynamicAPInt &A, int64_t B) {
62
62
return A <= SlowDynamicAPInt (B);
63
63
}
64
- bool detail::operator >=(const SlowDynamicAPInt &A, int64_t B) {
64
+ bool llvm:: detail::operator >=(const SlowDynamicAPInt &A, int64_t B) {
65
65
return A >= SlowDynamicAPInt (B);
66
66
}
67
- SlowDynamicAPInt detail::operator +(const SlowDynamicAPInt &A, int64_t B) {
67
+ SlowDynamicAPInt llvm:: detail::operator +(const SlowDynamicAPInt &A, int64_t B) {
68
68
return A + SlowDynamicAPInt (B);
69
69
}
70
- SlowDynamicAPInt detail::operator -(const SlowDynamicAPInt &A, int64_t B) {
70
+ SlowDynamicAPInt llvm:: detail::operator -(const SlowDynamicAPInt &A, int64_t B) {
71
71
return A - SlowDynamicAPInt (B);
72
72
}
73
- SlowDynamicAPInt detail::operator *(const SlowDynamicAPInt &A, int64_t B) {
73
+ SlowDynamicAPInt llvm:: detail::operator *(const SlowDynamicAPInt &A, int64_t B) {
74
74
return A * SlowDynamicAPInt (B);
75
75
}
76
- SlowDynamicAPInt detail::operator /(const SlowDynamicAPInt &A, int64_t B) {
76
+ SlowDynamicAPInt llvm:: detail::operator /(const SlowDynamicAPInt &A, int64_t B) {
77
77
return A / SlowDynamicAPInt (B);
78
78
}
79
- SlowDynamicAPInt detail::operator %(const SlowDynamicAPInt &A, int64_t B) {
79
+ SlowDynamicAPInt llvm:: detail::operator %(const SlowDynamicAPInt &A, int64_t B) {
80
80
return A % SlowDynamicAPInt (B);
81
81
}
82
82
83
- bool detail::operator ==(int64_t A, const SlowDynamicAPInt &B) {
83
+ bool llvm:: detail::operator ==(int64_t A, const SlowDynamicAPInt &B) {
84
84
return SlowDynamicAPInt (A) == B;
85
85
}
86
- bool detail::operator !=(int64_t A, const SlowDynamicAPInt &B) {
86
+ bool llvm:: detail::operator !=(int64_t A, const SlowDynamicAPInt &B) {
87
87
return SlowDynamicAPInt (A) != B;
88
88
}
89
- bool detail::operator >(int64_t A, const SlowDynamicAPInt &B) {
89
+ bool llvm:: detail::operator >(int64_t A, const SlowDynamicAPInt &B) {
90
90
return SlowDynamicAPInt (A) > B;
91
91
}
92
- bool detail::operator <(int64_t A, const SlowDynamicAPInt &B) {
92
+ bool llvm:: detail::operator <(int64_t A, const SlowDynamicAPInt &B) {
93
93
return SlowDynamicAPInt (A) < B;
94
94
}
95
- bool detail::operator <=(int64_t A, const SlowDynamicAPInt &B) {
95
+ bool llvm:: detail::operator <=(int64_t A, const SlowDynamicAPInt &B) {
96
96
return SlowDynamicAPInt (A) <= B;
97
97
}
98
- bool detail::operator >=(int64_t A, const SlowDynamicAPInt &B) {
98
+ bool llvm:: detail::operator >=(int64_t A, const SlowDynamicAPInt &B) {
99
99
return SlowDynamicAPInt (A) >= B;
100
100
}
101
- SlowDynamicAPInt detail::operator +(int64_t A, const SlowDynamicAPInt &B) {
101
+ SlowDynamicAPInt llvm:: detail::operator +(int64_t A, const SlowDynamicAPInt &B) {
102
102
return SlowDynamicAPInt (A) + B;
103
103
}
104
- SlowDynamicAPInt detail::operator -(int64_t A, const SlowDynamicAPInt &B) {
104
+ SlowDynamicAPInt llvm:: detail::operator -(int64_t A, const SlowDynamicAPInt &B) {
105
105
return SlowDynamicAPInt (A) - B;
106
106
}
107
- SlowDynamicAPInt detail::operator *(int64_t A, const SlowDynamicAPInt &B) {
107
+ SlowDynamicAPInt llvm:: detail::operator *(int64_t A, const SlowDynamicAPInt &B) {
108
108
return SlowDynamicAPInt (A) * B;
109
109
}
110
- SlowDynamicAPInt detail::operator /(int64_t A, const SlowDynamicAPInt &B) {
110
+ SlowDynamicAPInt llvm:: detail::operator /(int64_t A, const SlowDynamicAPInt &B) {
111
111
return SlowDynamicAPInt (A) / B;
112
112
}
113
- SlowDynamicAPInt detail::operator %(int64_t A, const SlowDynamicAPInt &B) {
113
+ SlowDynamicAPInt llvm:: detail::operator %(int64_t A, const SlowDynamicAPInt &B) {
114
114
return SlowDynamicAPInt (A) % B;
115
115
}
116
116
@@ -187,19 +187,19 @@ SlowDynamicAPInt SlowDynamicAPInt::operator/(const SlowDynamicAPInt &O) const {
187
187
return SlowDynamicAPInt (
188
188
runOpWithExpandOnOverflow (Val, O.Val , std::mem_fn (&APInt::sdiv_ov)));
189
189
}
190
- SlowDynamicAPInt detail::abs (const SlowDynamicAPInt &X) {
190
+ SlowDynamicAPInt llvm:: detail::abs (const SlowDynamicAPInt &X) {
191
191
return X >= 0 ? X : -X;
192
192
}
193
- SlowDynamicAPInt detail::ceilDiv (const SlowDynamicAPInt &LHS,
194
- const SlowDynamicAPInt &RHS) {
193
+ SlowDynamicAPInt llvm:: detail::ceilDiv (const SlowDynamicAPInt &LHS,
194
+ const SlowDynamicAPInt &RHS) {
195
195
if (RHS == -1 )
196
196
return -LHS;
197
197
unsigned Width = getMaxWidth (LHS.Val , RHS.Val );
198
198
return SlowDynamicAPInt (APIntOps::RoundingSDiv (
199
199
LHS.Val .sext (Width), RHS.Val .sext (Width), APInt::Rounding::UP));
200
200
}
201
- SlowDynamicAPInt detail::floorDiv (const SlowDynamicAPInt &LHS,
202
- const SlowDynamicAPInt &RHS) {
201
+ SlowDynamicAPInt llvm:: detail::floorDiv (const SlowDynamicAPInt &LHS,
202
+ const SlowDynamicAPInt &RHS) {
203
203
if (RHS == -1 )
204
204
return -LHS;
205
205
unsigned Width = getMaxWidth (LHS.Val , RHS.Val );
@@ -208,23 +208,23 @@ SlowDynamicAPInt detail::floorDiv(const SlowDynamicAPInt &LHS,
208
208
}
209
209
// The RHS is always expected to be positive, and the result
210
210
// / is always non-negative.
211
- SlowDynamicAPInt detail::mod (const SlowDynamicAPInt &LHS,
212
- const SlowDynamicAPInt &RHS) {
211
+ SlowDynamicAPInt llvm:: detail::mod (const SlowDynamicAPInt &LHS,
212
+ const SlowDynamicAPInt &RHS) {
213
213
assert (RHS >= 1 && " mod is only supported for positive divisors!" );
214
214
return LHS % RHS < 0 ? LHS % RHS + RHS : LHS % RHS;
215
215
}
216
216
217
- SlowDynamicAPInt detail::gcd (const SlowDynamicAPInt &A,
218
- const SlowDynamicAPInt &B) {
217
+ SlowDynamicAPInt llvm:: detail::gcd (const SlowDynamicAPInt &A,
218
+ const SlowDynamicAPInt &B) {
219
219
assert (A >= 0 && B >= 0 && " operands must be non-negative!" );
220
220
unsigned Width = getMaxWidth (A.Val , B.Val );
221
221
return SlowDynamicAPInt (
222
222
APIntOps::GreatestCommonDivisor (A.Val .sext (Width), B.Val .sext (Width)));
223
223
}
224
224
225
225
// / Returns the least common multiple of A and B.
226
- SlowDynamicAPInt detail::lcm (const SlowDynamicAPInt &A,
227
- const SlowDynamicAPInt &B) {
226
+ SlowDynamicAPInt llvm:: detail::lcm (const SlowDynamicAPInt &A,
227
+ const SlowDynamicAPInt &B) {
228
228
SlowDynamicAPInt X = abs (A);
229
229
SlowDynamicAPInt Y = abs (B);
230
230
return (X * Y) / gcd (X, Y);
0 commit comments