File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,31 @@ impl Lapack for f64 {}
126
126
impl Lapack for c32 { }
127
127
impl Lapack for c64 { }
128
128
129
+ /// Helper for getting pointer of slice
130
+ pub ( crate ) trait AsPtr : Sized {
131
+ type Elem ;
132
+ fn as_ptr ( vec : & [ Self ] ) -> * const Self :: Elem ;
133
+ fn as_mut_ptr ( vec : & mut [ Self ] ) -> * mut Self :: Elem ;
134
+ }
135
+
136
+ macro_rules! impl_as_ptr {
137
+ ( $target: ty, $elem: ty) => {
138
+ impl AsPtr for $target {
139
+ type Elem = $elem;
140
+ fn as_ptr( vec: & [ Self ] ) -> * const Self :: Elem {
141
+ vec. as_ptr( ) as * const _
142
+ }
143
+ fn as_mut_ptr( vec: & mut [ Self ] ) -> * mut Self :: Elem {
144
+ vec. as_mut_ptr( ) as * mut _
145
+ }
146
+ }
147
+ } ;
148
+ }
149
+ impl_as_ptr ! ( f32 , f32 ) ;
150
+ impl_as_ptr ! ( f64 , f64 ) ;
151
+ impl_as_ptr ! ( c32, lapack_sys:: __BindgenComplex<f32 >) ;
152
+ impl_as_ptr ! ( c64, lapack_sys:: __BindgenComplex<f64 >) ;
153
+
129
154
/// Upper/Lower specification for seveal usages
130
155
#[ derive( Debug , Clone , Copy ) ]
131
156
#[ repr( u8 ) ]
You can’t perform that action at this time.
0 commit comments