update n-body for comparison

This commit is contained in:
dcode
2019-03-19 10:09:06 +01:00
parent 7693b543f4
commit d42ef51cf0
6 changed files with 1198 additions and 1085 deletions

View File

@ -96,7 +96,7 @@ class NBodySystem {
py += b.vy * m;
pz += b.vz * m;
}
bodies[0].offsetMomentum(px, py, pz);
unchecked(bodies[0]).offsetMomentum(px, py, pz);
}
advance(dt: float): void {
@ -206,5 +206,5 @@ export function bench(steps: u32): void {
export function getBody(index: i32): Body | null {
var bodies = system.bodies;
return <u32>index < <u32>bodies.length ? bodies[index] : null;
return <u32>index < <u32>bodies.length ? unchecked(bodies[index]) : null;
}