Skip to content

Commit 0b90493

Browse files
committed
auto merge of #6034 : thestinger/rust/num, r=catamorphism,pcwalton
2 parents d9896d5 + a3e33cf commit 0b90493

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

src/libcore/num/f32.rs

+13
Original file line numberDiff line numberDiff line change
@@ -301,40 +301,53 @@ impl num::One for f32 {
301301

302302
#[cfg(notest)]
303303
impl Add<f32,f32> for f32 {
304+
#[inline(always)]
304305
fn add(&self, other: &f32) -> f32 { *self + *other }
305306
}
307+
306308
#[cfg(notest)]
307309
impl Sub<f32,f32> for f32 {
310+
#[inline(always)]
308311
fn sub(&self, other: &f32) -> f32 { *self - *other }
309312
}
313+
310314
#[cfg(notest)]
311315
impl Mul<f32,f32> for f32 {
316+
#[inline(always)]
312317
fn mul(&self, other: &f32) -> f32 { *self * *other }
313318
}
319+
314320
#[cfg(stage0,notest)]
315321
impl Div<f32,f32> for f32 {
322+
#[inline(always)]
316323
fn div(&self, other: &f32) -> f32 { *self / *other }
317324
}
325+
318326
#[cfg(stage1,notest)]
319327
#[cfg(stage2,notest)]
320328
#[cfg(stage3,notest)]
321329
impl Quot<f32,f32> for f32 {
322330
#[inline(always)]
323331
fn quot(&self, other: &f32) -> f32 { *self / *other }
324332
}
333+
325334
#[cfg(stage0,notest)]
326335
impl Modulo<f32,f32> for f32 {
336+
#[inline(always)]
327337
fn modulo(&self, other: &f32) -> f32 { *self % *other }
328338
}
339+
329340
#[cfg(stage1,notest)]
330341
#[cfg(stage2,notest)]
331342
#[cfg(stage3,notest)]
332343
impl Rem<f32,f32> for f32 {
333344
#[inline(always)]
334345
fn rem(&self, other: &f32) -> f32 { *self % *other }
335346
}
347+
336348
#[cfg(notest)]
337349
impl Neg<f32> for f32 {
350+
#[inline(always)]
338351
fn neg(&self) -> f32 { -*self }
339352
}
340353

src/libcore/num/float.rs

+9
Original file line numberDiff line numberDiff line change
@@ -455,18 +455,25 @@ impl num::Round for float {
455455
456456
#[cfg(notest)]
457457
impl Add<float,float> for float {
458+
#[inline(always)]
458459
fn add(&self, other: &float) -> float { *self + *other }
459460
}
461+
460462
#[cfg(notest)]
461463
impl Sub<float,float> for float {
464+
#[inline(always)]
462465
fn sub(&self, other: &float) -> float { *self - *other }
463466
}
467+
464468
#[cfg(notest)]
465469
impl Mul<float,float> for float {
470+
#[inline(always)]
466471
fn mul(&self, other: &float) -> float { *self * *other }
467472
}
473+
468474
#[cfg(stage0,notest)]
469475
impl Div<float,float> for float {
476+
#[inline(always)]
470477
fn div(&self, other: &float) -> float { *self / *other }
471478
}
472479
#[cfg(stage1,notest)]
@@ -478,6 +485,7 @@ impl Quot<float,float> for float {
478485
}
479486
#[cfg(stage0,notest)]
480487
impl Modulo<float,float> for float {
488+
#[inline(always)]
481489
fn modulo(&self, other: &float) -> float { *self % *other }
482490
}
483491
#[cfg(stage1,notest)]
@@ -489,6 +497,7 @@ impl Rem<float,float> for float {
489497
}
490498
#[cfg(notest)]
491499
impl Neg<float> for float {
500+
#[inline(always)]
492501
fn neg(&self) -> float { -*self }
493502
}
494503

src/libcore/num/int-template.rs

+18
Original file line numberDiff line numberDiff line change
@@ -175,40 +175,53 @@ impl num::One for T {
175175
176176
#[cfg(notest)]
177177
impl Add<T,T> for T {
178+
#[inline(always)]
178179
fn add(&self, other: &T) -> T { *self + *other }
179180
}
181+
180182
#[cfg(notest)]
181183
impl Sub<T,T> for T {
184+
#[inline(always)]
182185
fn sub(&self, other: &T) -> T { *self - *other }
183186
}
187+
184188
#[cfg(notest)]
185189
impl Mul<T,T> for T {
190+
#[inline(always)]
186191
fn mul(&self, other: &T) -> T { *self * *other }
187192
}
193+
188194
#[cfg(stage0,notest)]
189195
impl Div<T,T> for T {
196+
#[inline(always)]
190197
fn div(&self, other: &T) -> T { *self / *other }
191198
}
199+
192200
#[cfg(stage1,notest)]
193201
#[cfg(stage2,notest)]
194202
#[cfg(stage3,notest)]
195203
impl Quot<T,T> for T {
196204
#[inline(always)]
197205
fn quot(&self, other: &T) -> T { *self / *other }
198206
}
207+
199208
#[cfg(stage0,notest)]
200209
impl Modulo<T,T> for T {
210+
#[inline(always)]
201211
fn modulo(&self, other: &T) -> T { *self % *other }
202212
}
213+
203214
#[cfg(stage1,notest)]
204215
#[cfg(stage2,notest)]
205216
#[cfg(stage3,notest)]
206217
impl Rem<T,T> for T {
207218
#[inline(always)]
208219
fn rem(&self, other: &T) -> T { *self % *other }
209220
}
221+
210222
#[cfg(notest)]
211223
impl Neg<T> for T {
224+
#[inline(always)]
212225
fn neg(&self) -> T { -*self }
213226
}
214227
@@ -217,26 +230,31 @@ impl BitOr<T,T> for T {
217230
#[inline(always)]
218231
fn bitor(&self, other: &T) -> T { *self | *other }
219232
}
233+
220234
#[cfg(notest)]
221235
impl BitAnd<T,T> for T {
222236
#[inline(always)]
223237
fn bitand(&self, other: &T) -> T { *self & *other }
224238
}
239+
225240
#[cfg(notest)]
226241
impl BitXor<T,T> for T {
227242
#[inline(always)]
228243
fn bitxor(&self, other: &T) -> T { *self ^ *other }
229244
}
245+
230246
#[cfg(notest)]
231247
impl Shl<T,T> for T {
232248
#[inline(always)]
233249
fn shl(&self, other: &T) -> T { *self << *other }
234250
}
251+
235252
#[cfg(notest)]
236253
impl Shr<T,T> for T {
237254
#[inline(always)]
238255
fn shr(&self, other: &T) -> T { *self >> *other }
239256
}
257+
240258
#[cfg(notest)]
241259
impl Not<T> for T {
242260
#[inline(always)]

src/libcore/num/uint-template.rs

+18
Original file line numberDiff line numberDiff line change
@@ -140,40 +140,53 @@ impl num::One for T {
140140
141141
#[cfg(notest)]
142142
impl Add<T,T> for T {
143+
#[inline(always)]
143144
fn add(&self, other: &T) -> T { *self + *other }
144145
}
146+
145147
#[cfg(notest)]
146148
impl Sub<T,T> for T {
149+
#[inline(always)]
147150
fn sub(&self, other: &T) -> T { *self - *other }
148151
}
152+
149153
#[cfg(notest)]
150154
impl Mul<T,T> for T {
155+
#[inline(always)]
151156
fn mul(&self, other: &T) -> T { *self * *other }
152157
}
158+
153159
#[cfg(stage0,notest)]
154160
impl Div<T,T> for T {
161+
#[inline(always)]
155162
fn div(&self, other: &T) -> T { *self / *other }
156163
}
164+
157165
#[cfg(stage1,notest)]
158166
#[cfg(stage2,notest)]
159167
#[cfg(stage3,notest)]
160168
impl Quot<T,T> for T {
161169
#[inline(always)]
162170
fn quot(&self, other: &T) -> T { *self / *other }
163171
}
172+
164173
#[cfg(stage0,notest)]
165174
impl Modulo<T,T> for T {
175+
#[inline(always)]
166176
fn modulo(&self, other: &T) -> T { *self % *other }
167177
}
178+
168179
#[cfg(stage1,notest)]
169180
#[cfg(stage2,notest)]
170181
#[cfg(stage3,notest)]
171182
impl Rem<T,T> for T {
172183
#[inline(always)]
173184
fn rem(&self, other: &T) -> T { *self % *other }
174185
}
186+
175187
#[cfg(notest)]
176188
impl Neg<T> for T {
189+
#[inline(always)]
177190
fn neg(&self) -> T { -*self }
178191
}
179192
@@ -182,26 +195,31 @@ impl BitOr<T,T> for T {
182195
#[inline(always)]
183196
fn bitor(&self, other: &T) -> T { *self | *other }
184197
}
198+
185199
#[cfg(notest)]
186200
impl BitAnd<T,T> for T {
187201
#[inline(always)]
188202
fn bitand(&self, other: &T) -> T { *self & *other }
189203
}
204+
190205
#[cfg(notest)]
191206
impl BitXor<T,T> for T {
192207
#[inline(always)]
193208
fn bitxor(&self, other: &T) -> T { *self ^ *other }
194209
}
210+
195211
#[cfg(notest)]
196212
impl Shl<T,T> for T {
197213
#[inline(always)]
198214
fn shl(&self, other: &T) -> T { *self << *other }
199215
}
216+
200217
#[cfg(notest)]
201218
impl Shr<T,T> for T {
202219
#[inline(always)]
203220
fn shr(&self, other: &T) -> T { *self >> *other }
204221
}
222+
205223
#[cfg(notest)]
206224
impl Not<T> for T {
207225
#[inline(always)]

0 commit comments

Comments
 (0)