Skip to content

Commit ab6af37

Browse files
committed
Simdf64 from attempt
1 parent 2591c59 commit ab6af37

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crates/core_simd/examples/nbody.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ use std::f64::consts::PI;
55
const SOLAR_MASS: f64 = 4.0 * PI * PI;
66
const DAYS_PER_YEAR: f64 = 365.24;
77

8+
#[derive(Debug)]
9+
#[repr(simd)]
810
pub struct Body {
9-
pub x: f64x4,
10-
pub v: f64x4,
11+
pub x: Simdf64([f64, 4]),
12+
pub v: Simdf64([f64, 4]),
1113
pub mass: f64,
1214
}
15+
16+
// Translation attempt is this ^^^ far
17+
//
1318
const N_BODIES: usize = 5;
1419
#[allow(clippy::unreadable_literal)]
1520
const BODIES: [Body; N_BODIES] = [

0 commit comments

Comments
 (0)