diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-06-01 11:49:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-01 11:49:25 -0400 |
| commit | 3918e7699db07540d59aeef7728e5dff54d9e874 (patch) | |
| tree | 5ccfd67157be19b745c469e923ed92691670b6e9 /std/math/complex/index.zig | |
| parent | 717ac85a5acb5e6ae063c4d0eb3b8f1bd260776a (diff) | |
| parent | e29d12d8218c6f84d4fd59b7c8672d3b38c79390 (diff) | |
| download | zig-3918e7699db07540d59aeef7728e5dff54d9e874.tar.gz zig-3918e7699db07540d59aeef7728e5dff54d9e874.zip | |
Merge pull request #1032 from ziglang/pointer-reform
use * for pointer type instead of &
Diffstat (limited to 'std/math/complex/index.zig')
| -rw-r--r-- | std/math/complex/index.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/std/math/complex/index.zig b/std/math/complex/index.zig index 5902ffaa19..b00296beda 100644 --- a/std/math/complex/index.zig +++ b/std/math/complex/index.zig @@ -37,28 +37,28 @@ pub fn Complex(comptime T: type) type { }; } - pub fn add(self: &const Self, other: &const Self) Self { + pub fn add(self: *const Self, other: *const Self) Self { return Self{ .re = self.re + other.re, .im = self.im + other.im, }; } - pub fn sub(self: &const Self, other: &const Self) Self { + pub fn sub(self: *const Self, other: *const Self) Self { return Self{ .re = self.re - other.re, .im = self.im - other.im, }; } - pub fn mul(self: &const Self, other: &const Self) Self { + pub fn mul(self: *const Self, other: *const Self) Self { return Self{ .re = self.re * other.re - self.im * other.im, .im = self.im * other.re + self.re * other.im, }; } - pub fn div(self: &const Self, other: &const Self) Self { + pub fn div(self: *const Self, other: *const Self) Self { const re_num = self.re * other.re + self.im * other.im; const im_num = self.im * other.re - self.re * other.im; const den = other.re * other.re + other.im * other.im; @@ -69,14 +69,14 @@ pub fn Complex(comptime T: type) type { }; } - pub fn conjugate(self: &const Self) Self { + pub fn conjugate(self: *const Self) Self { return Self{ .re = self.re, .im = -self.im, }; } - pub fn reciprocal(self: &const Self) Self { + pub fn reciprocal(self: *const Self) Self { const m = self.re * self.re + self.im * self.im; return Self{ .re = self.re / m, @@ -84,7 +84,7 @@ pub fn Complex(comptime T: type) type { }; } - pub fn magnitude(self: &const Self) T { + pub fn magnitude(self: *const Self) T { return math.sqrt(self.re * self.re + self.im * self.im); } }; |
