Skip to content

Commit 27a0448

Browse files
author
Marius Isken
committed
planer: constant reference to plan
1 parent fdd5c3b commit 27a0448

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

fftw/src/plan.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ pub struct Plan<A, B, Plan: PlanSpec> {
3636
phantom: PhantomData<(A, B)>,
3737
}
3838

39+
unsafe impl<A: Sync, B: Sync> Sync for Plan<A, B, Plan32> {}
40+
unsafe impl<A: Sync, B: Sync> Sync for Plan<A, B, Plan64> {}
3941
unsafe impl<A: Send, B: Send> Send for Plan<A, B, Plan32> {}
4042
unsafe impl<A: Send, B: Send> Send for Plan<A, B, Plan64> {}
4143

@@ -97,7 +99,7 @@ pub trait C2CPlan: Sized {
9799
) -> Result<Self>;
98100

99101
/// Execute complex-to-complex transform
100-
fn c2c(&mut self, in_: &mut [Self::Complex], out: &mut [Self::Complex]) -> Result<()>;
102+
fn c2c(&self, in_: &mut [Self::Complex], out: &mut [Self::Complex]) -> Result<()>;
101103
}
102104

103105
/// Trait for the plan of Real-to-Complex transformation
@@ -124,7 +126,7 @@ pub trait R2CPlan: Sized {
124126
) -> Result<Self>;
125127

126128
/// Execute real-to-complex transform
127-
fn r2c(&mut self, in_: &mut [Self::Real], out: &mut [Self::Complex]) -> Result<()>;
129+
fn r2c(&self, in_: &mut [Self::Real], out: &mut [Self::Complex]) -> Result<()>;
128130
}
129131

130132
/// Trait for the plan of Complex-to-Real transformation
@@ -151,7 +153,7 @@ pub trait C2RPlan: Sized {
151153
) -> Result<Self>;
152154

153155
/// Execute complex-to-real transform
154-
fn c2r(&mut self, in_: &mut [Self::Complex], out: &mut [Self::Real]) -> Result<()>;
156+
fn c2r(&self, in_: &mut [Self::Complex], out: &mut [Self::Real]) -> Result<()>;
155157
}
156158

157159
pub trait R2RPlan: Sized {
@@ -175,7 +177,7 @@ pub trait R2RPlan: Sized {
175177
) -> Result<Self>;
176178

177179
/// Execute complex-to-complex transform
178-
fn r2r(&mut self, in_: &mut [Self::Real], out: &mut [Self::Real]) -> Result<()>;
180+
fn r2r(&self, in_: &mut [Self::Real], out: &mut [Self::Real]) -> Result<()>;
179181
}
180182

181183
macro_rules! impl_c2c {
@@ -204,7 +206,7 @@ macro_rules! impl_c2c {
204206
phantom: PhantomData,
205207
})
206208
}
207-
fn c2c(&mut self, in_: &mut [Self::Complex], out: &mut [Self::Complex]) -> Result<()> {
209+
fn c2c(&self, in_: &mut [Self::Complex], out: &mut [Self::Complex]) -> Result<()> {
208210
self.check(in_, out)?;
209211
unsafe { $exec(self.plan, in_.as_mut_ptr(), out.as_mut_ptr()) };
210212
Ok(())
@@ -242,7 +244,7 @@ macro_rules! impl_r2c {
242244
phantom: PhantomData,
243245
})
244246
}
245-
fn r2c(&mut self, in_: &mut [Self::Real], out: &mut [Self::Complex]) -> Result<()> {
247+
fn r2c(&self, in_: &mut [Self::Real], out: &mut [Self::Complex]) -> Result<()> {
246248
self.check(in_, out)?;
247249
unsafe { $exec(self.plan, in_.as_mut_ptr(), out.as_mut_ptr()) };
248250
Ok(())
@@ -280,7 +282,7 @@ macro_rules! impl_c2r {
280282
phantom: PhantomData,
281283
})
282284
}
283-
fn c2r(&mut self, in_: &mut [Self::Complex], out: &mut [Self::Real]) -> Result<()> {
285+
fn c2r(&self, in_: &mut [Self::Complex], out: &mut [Self::Real]) -> Result<()> {
284286
self.check(in_, out)?;
285287
unsafe { $exec(self.plan, in_.as_mut_ptr(), out.as_mut_ptr()) };
286288
Ok(())
@@ -318,7 +320,7 @@ macro_rules! impl_r2r {
318320
phantom: PhantomData,
319321
})
320322
}
321-
fn r2r(&mut self, in_: &mut [Self::Real], out: &mut [Self::Real]) -> Result<()> {
323+
fn r2r(&self, in_: &mut [Self::Real], out: &mut [Self::Real]) -> Result<()> {
322324
self.check(in_, out)?;
323325
unsafe { $exec(self.plan, in_.as_mut_ptr(), out.as_mut_ptr()) };
324326
Ok(())

0 commit comments

Comments
 (0)