aboutsummaryrefslogtreecommitdiff
path: root/src/square.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/square.rs')
-rw-r--r--src/square.rs4
1 files changed, 2 insertions, 2 deletions
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 {