rust/integral-geometry/src/lib.rs
changeset 15384 1c6d5656157c
parent 15286 16bd389fc735
child 15751 a4558e2be08c
equal deleted inserted replaced
15383:701ad89a9f2a 15384:1c6d5656157c
    43         std::cmp::max(self.x.abs(), self.y.abs())
    43         std::cmp::max(self.x.abs(), self.y.abs())
    44     }
    44     }
    45 
    45 
    46     #[inline]
    46     #[inline]
    47     pub fn integral_norm(self) -> u32 {
    47     pub fn integral_norm(self) -> u32 {
    48         let sqr = (self.x as u64).pow(2) + (self.y as u64).pow(2);
    48         let sqr = (self.x as u64).wrapping_pow(2) + (self.y as u64).wrapping_pow(2);
    49         integral_sqrt(sqr) as u32
    49         integral_sqrt(sqr) as u32
    50     }
    50     }
    51 
    51 
    52     #[inline]
    52     #[inline]
    53     pub const fn transform(self, matrix: &[i32; 4]) -> Self {
    53     pub const fn transform(self, matrix: &[i32; 4]) -> Self {