From 6e0e8656ceb8547c8ab6e6784b265940ee74d9c8 Mon Sep 17 00:00:00 2001 From: rexim Date: Thu, 3 Oct 2019 01:04:49 +0700 Subject: [PATCH] (#24) Make vec2.len and vec2.norm inlinable --- src/vec2.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vec2.nim b/src/vec2.nim index 4960737..8cf3627 100644 --- a/src/vec2.nim +++ b/src/vec2.nim @@ -13,10 +13,10 @@ proc `*=`*(v: var Vec2, s: float) {.inline.} = v.x *= s v.y *= s -proc len*(v: Vec2): float = +proc len*(v: Vec2): float {.inline.} = sqrt(v.x * v.x + v.y * v.y) -proc norm*(v: Vec2): Vec2 = +proc norm*(v: Vec2): Vec2 {.inline.} = let l = v.len if abs(l) < 1e-9: result = (0.0, 0.0)