@@ -114,14 +114,26 @@ impl ConstGenerator for Complex<f64> {
114114 }
115115}
116116
117+ #[ allow( unused_mut) ]
118+ impl ConstGenerator for bool {
119+ fn generate ( & self , dims : Dim4 ) -> Array {
120+ unsafe {
121+ let mut temp: i64 = 0 ;
122+ af_constant ( & mut temp as MutAfArray , * self as c_int as c_double ,
123+ dims. ndims ( ) as c_uint , dims. get ( ) . as_ptr ( ) as * const DimT , 4 ) ;
124+ Array :: from ( temp)
125+ }
126+ }
127+ }
128+ 117129macro_rules! cnst {
118130 ( $rust_type: ty, $ffi_type: expr) => (
119131 #[ allow( unused_mut) ]
120132 impl ConstGenerator for $rust_type {
121133 fn generate( & self , dims: Dim4 ) -> Array {
122134 unsafe {
123135 let mut temp: i64 = 0 ;
124- af_constant( & mut temp as MutAfArray , * self as u64 as c_double,
136+ af_constant( & mut temp as MutAfArray , * self as c_double,
125137 dims. ndims( ) as c_uint, dims. get( ) . as_ptr( ) as * const DimT ,
126138 $ffi_type) ;
127139 Array :: from( temp)
@@ -133,7 +145,6 @@ macro_rules! cnst {
133145
134146cnst ! ( f32 , 0 ) ;
135147cnst ! ( f64 , 2 ) ;
136- cnst ! ( bool , 4 ) ;
137148cnst ! ( i32 , 5 ) ;
138149cnst ! ( u32 , 6 ) ;
139150cnst ! ( u8 , 7 ) ;
0 commit comments