From cae14cd6f19c40be2c30b638a51a02c4da0959ea Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 2 Feb 2023 20:51:25 +0300 Subject: refactor: use functions for file and rank --- src/square.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/square.rs') diff --git a/src/square.rs b/src/square.rs index 2e47bea..8a268ea 100644 --- a/src/square.rs +++ b/src/square.rs @@ -27,11 +27,11 @@ impl Square { } /// 0-based rank pub fn rank(&self) -> u8 { - *self as u8 / 8 + *self as u8 >> 3 } /// 0-based file pub fn file(&self) -> u8 { - *self as u8 % 8 + *self as u8 & 7 } pub fn nort_one(&self) -> Self { -- cgit v1.2.3