Created
July 18, 2017 01:42
-
-
Save anonymous/af6757cb35c21a7e67e634e1e2f552f7 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsafe extern fn exp_rotation1( | |
mut X : *mut f32, | |
mut len : i32, | |
mut stride : i32, | |
mut c : f32, | |
mut s : f32 | |
) { | |
let mut i : i32; | |
let mut ms : f32; | |
let mut Xptr : *mut f32; | |
Xptr = X; | |
ms = -s; | |
i = 0i32; | |
'loop1: loop { | |
if !(i < len - stride) { | |
break; | |
} | |
let mut x1 : f32; | |
let mut x2 : f32; | |
x1 = *Xptr.offset(0isize); | |
x2 = *Xptr.offset(stride as (isize)); | |
*Xptr.offset(stride as (isize)) = c * x2 + s * x1; | |
*{ | |
let _old = Xptr; | |
Xptr = Xptr.offset(1isize); | |
_old | |
} = c * x1 + ms * x2; | |
i = i + 1; | |
} | |
Xptr = &mut *X.offset( | |
(len - 2i32 * stride - 1i32) as (isize) | |
) as (*mut f32); | |
i = len - 2i32 * stride - 1i32; | |
'loop3: loop { | |
if !(i >= 0i32) { | |
break; | |
} | |
let mut x1 : f32; | |
let mut x2 : f32; | |
x1 = *Xptr.offset(0isize); | |
x2 = *Xptr.offset(stride as (isize)); | |
*Xptr.offset(stride as (isize)) = c * x2 + s * x1; | |
*{ | |
let _old = Xptr; | |
Xptr = Xptr.offset(-1isize); | |
_old | |
} = c * x1 + ms * x2; | |
i = i - 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment