@@ -352,13 +352,13 @@ pub fn clamp<T, U> (input: &Array, arg1: &T, arg2: &U, batch: bool) -> Array
352
352
}
353
353
354
354
macro_rules! arith_scalar_func {
355
- ( $rust_type: ty, $op_name: ident, $fn_name: ident, $ffi_fn : ident ) => (
355
+ ( $rust_type: ty, $op_name: ident, $fn_name: ident) => (
356
356
impl <' f> $op_name<$rust_type> for & ' f Array {
357
357
type Output = Array ;
358
358
359
359
fn $fn_name( self , rhs: $rust_type) -> Array {
360
360
let temp = rhs. clone( ) ;
361
- add ( self , & temp, false )
361
+ $fn_name ( self , & temp, false )
362
362
}
363
363
}
364
364
@@ -367,18 +367,18 @@ macro_rules! arith_scalar_func {
367
367
368
368
fn $fn_name( self , rhs: $rust_type) -> Array {
369
369
let temp = rhs. clone( ) ;
370
- add ( & self , & temp, false )
370
+ $fn_name ( & self , & temp, false )
371
371
}
372
372
}
373
373
)
374
374
}
375
375
376
376
macro_rules! arith_scalar_spec {
377
377
( $ty_name: ty) => (
378
- arith_scalar_func!( $ty_name, Add , add, af_add ) ;
379
- arith_scalar_func!( $ty_name, Sub , sub, af_sub ) ;
380
- arith_scalar_func!( $ty_name, Mul , mul, af_mul ) ;
381
- arith_scalar_func!( $ty_name, Div , div, af_div ) ;
378
+ arith_scalar_func!( $ty_name, Add , add) ;
379
+ arith_scalar_func!( $ty_name, Sub , sub) ;
380
+ arith_scalar_func!( $ty_name, Mul , mul) ;
381
+ arith_scalar_func!( $ty_name, Div , div) ;
382
382
)
383
383
}
384
384
@@ -393,51 +393,51 @@ arith_scalar_spec!(i32);
393
393
arith_scalar_spec ! ( u8 ) ;
394
394
395
395
macro_rules! arith_func {
396
- ( $op_name: ident, $fn_name: ident) => (
396
+ ( $op_name: ident, $fn_name: ident, $delegate : ident ) => (
397
397
impl $op_name<Array > for Array {
398
398
type Output = Array ;
399
399
400
400
fn $fn_name( self , rhs: Array ) -> Array {
401
- add ( & self , & rhs, false )
401
+ $delegate ( & self , & rhs, false )
402
402
}
403
403
}
404
404
405
405
impl <' a> $op_name<& ' a Array > for Array {
406
406
type Output = Array ;
407
407
408
408
fn $fn_name( self , rhs: & ' a Array ) -> Array {
409
- add ( & self , rhs, false )
409
+ $delegate ( & self , rhs, false )
410
410
}
411
411
}
412
412
413
413
impl <' a> $op_name<Array > for & ' a Array {
414
414
type Output = Array ;
415
415
416
416
fn $fn_name( self , rhs: Array ) -> Array {
417
- add ( self , & rhs, false )
417
+ $delegate ( self , & rhs, false )
418
418
}
419
419
}
420
420
421
421
impl <' a, ' b> $op_name<& ' a Array > for & ' b Array {
422
422
type Output = Array ;
423
423
424
424
fn $fn_name( self , rhs: & ' a Array ) -> Array {
425
- add ( self , rhs, false )
425
+ $delegate ( self , rhs, false )
426
426
}
427
427
}
428
428
)
429
429
}
430
430
431
- arith_func ! ( Add , add ) ;
432
- arith_func ! ( Sub , sub ) ;
433
- arith_func ! ( Mul , mul ) ;
434
- arith_func ! ( Div , div ) ;
435
- arith_func ! ( Rem , rem ) ;
436
- arith_func ! ( BitAnd , bitand ) ;
437
- arith_func ! ( BitOr , bitor ) ;
438
- arith_func ! ( BitXor , bitxor ) ;
439
- arith_func ! ( Shl , shl ) ;
440
- arith_func ! ( Shr , shr ) ;
431
+ arith_func ! ( Add , add , add ) ;
432
+ arith_func ! ( Sub , sub , sub ) ;
433
+ arith_func ! ( Mul , mul , mul ) ;
434
+ arith_func ! ( Div , div , div ) ;
435
+ arith_func ! ( Rem , rem , rem ) ;
436
+ arith_func ! ( Shl , shl , shiftl ) ;
437
+ arith_func ! ( Shr , shr , shiftr ) ;
438
+ arith_func ! ( BitAnd , bitand , bitand ) ;
439
+ arith_func ! ( BitOr , bitor , bitor ) ;
440
+ arith_func ! ( BitXor , bitxor , bitxor ) ;
441
441
442
442
#[ cfg( op_assign) ]
443
443
mod op_assign {
0 commit comments