diff options
author | metamuffin <metamuffin@disroot.org> | 2022-12-13 20:01:01 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-12-13 20:01:01 +0100 |
commit | 82eedf3594bf21c8b780580050a95f0bdb5fd667 (patch) | |
tree | 7189b1e46546b963eb44a09920918c76b16e0880 /evc/src/helpers | |
parent | 4f9ff288cfd66dc33cf66ae9085075f7a242685b (diff) | |
download | video-codec-experiments-82eedf3594bf21c8b780580050a95f0bdb5fd667.tar video-codec-experiments-82eedf3594bf21c8b780580050a95f0bdb5fd667.tar.bz2 video-codec-experiments-82eedf3594bf21c8b780580050a95f0bdb5fd667.tar.zst |
minor changes
Diffstat (limited to 'evc/src/helpers')
-rw-r--r-- | evc/src/helpers/vector.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/evc/src/helpers/vector.rs b/evc/src/helpers/vector.rs index 7cb180a..0209c58 100644 --- a/evc/src/helpers/vector.rs +++ b/evc/src/helpers/vector.rs @@ -4,6 +4,23 @@ pub struct Vec2<T> { pub y: T, } +impl From<Vec2<isize>> for Vec2<u16> { + fn from(value: Vec2<isize>) -> Self { + Self { + x: value.x as u16, + y: value.y as u16, + } + } +} +impl From<Vec2<u16>> for Vec2<isize> { + fn from(value: Vec2<u16>) -> Self { + Self { + x: value.x as isize, + y: value.y as isize, + } + } +} + impl Vec2<isize> { pub const ZERO: Vec2<isize> = Vec2 { x: 0, y: 0 }; pub const UP: Vec2<isize> = Vec2 { x: 0, y: -1 }; |