From 9210b2500fdc98a2ca769637aa74c5d362c782dc Mon Sep 17 00:00:00 2001 From: bendn Date: Tue, 23 Jan 2024 07:21:17 +0700 Subject: [PATCH] bump --- Cargo.toml | 2 +- src/affine.rs | 4 ++-- src/lib.rs | 7 ++++--- src/overlay.rs | 4 ++-- src/uninit.rs | 10 ++-------- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 371ddf4..c7c6f1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fimg" -version = "0.4.32" +version = "0.4.33" authors = ["bend-n "] license = "MIT" edition = "2021" diff --git a/src/affine.rs b/src/affine.rs index 9fc7b3c..d18d210 100644 --- a/src/affine.rs +++ b/src/affine.rs @@ -207,10 +207,10 @@ unsafe fn transpose + AsRef<[u8]>>( ) { debug_assert_eq!(img.width(), img.height()); if img.width().is_power_of_two() { - // SAFETY: caller gurantees + // SAFETY: caller guarantees unsafe { transpose_diag(img, 0, img.width() as usize) }; } else { - // SAFETY: caller gurantees + // SAFETY: caller guarantees unsafe { transpose_non_power_of_two(img) }; } } diff --git a/src/lib.rs b/src/lib.rs index 098fc03..74f4ef4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,8 @@ //! //! - [`Image`]: the main image type. //! - [`DynImage`]: This is the image type you use when, say, loading a png. You should immediately convert this into a -//! - [`ImageCloner`]: this is... a [`Image`], but about to be cloned. It just allows some simple out-of-place optimizations, that `.clone().op()` dont allow. (produce with [`Image::cloner`]) +//! - [`ImageCloner`]: This is... a [`Image`], but about to be cloned. It just allows some simple out-of-place optimizations, that `.clone().op()` dont allow. (produce with [`Image::cloner`]) +//! - [`uninit::Image`]: A uninitialized image. Used for performance optimization. //! //! ### Operations //! @@ -283,7 +284,7 @@ impl Image { /// # Safety /// - /// the output index is not guranteed to be in bounds + /// the output index is not guaranteed to be in bounds #[inline] fn at(&self, x: u32, y: u32) -> usize { (self.width(), self.height()).at::(x, y) @@ -418,7 +419,7 @@ impl Image { /// # Safety /// - /// the output index is not guranteed to be in bounds + /// the output index is not guaranteed to be in bounds #[inline] fn slice(&self, x: u32, y: u32) -> Range where diff --git a/src/overlay.rs b/src/overlay.rs index eef4272..d2d6c85 100644 --- a/src/overlay.rs +++ b/src/overlay.rs @@ -76,7 +76,7 @@ unsafe fn blit(rgb: &mut [u8], rgba: &[u8]) { while dsti + 16 <= rgb.len() { // SAFETY: i think it ok let old: Simd = Simd::from_slice(unsafe { rgb.get_unchecked(dsti..dsti + 16) }); - // SAFETY: definetly ok + // SAFETY: definitly ok let new: Simd = Simd::from_slice(unsafe { rgba.get_unchecked(srci..srci + 16) }); let threshold = new.simd_ge(Simd::splat(128)).to_int().cast::(); @@ -98,7 +98,7 @@ unsafe fn blit(rgb: &mut [u8], rgba: &[u8]) { } while dsti + 3 <= rgb.len() { - // SAFETY: caller gurantees slice is big enough + // SAFETY: caller guarantees slice is big enough if unsafe { *rgba.get_unchecked(srci + 3) } >= 128 { // SAFETY: slice is big enough! let src = unsafe { rgba.get_unchecked(srci..=srci + 2) }; diff --git a/src/uninit.rs b/src/uninit.rs index c4c341b..5be941f 100644 --- a/src/uninit.rs +++ b/src/uninit.rs @@ -1,14 +1,8 @@ //! the houser of uninitialized memory. €$@!0В𴬔!℡ //! //! contains [`Image`], an uninitialized image. -use std::{ - hint::assert_unchecked, - mem::MaybeUninit, - num::NonZeroU32, - ops::{Index, IndexMut}, -}; - use crate::{span::Span, CopyWithinUnchecked}; +use std::{hint::assert_unchecked, mem::MaybeUninit, num::NonZeroU32, ops::Index}; /// A uninitialized image. Be sure to initialize it! pub struct Image { @@ -72,7 +66,7 @@ impl Image { /// # Safety /// - /// the output index is not guranteed to be in bounds + /// the output index is not guaranteed to be in bounds #[inline] pub fn at(&self, x: u32, y: u32) -> usize { crate::At::at::((self.width(), self.height()), x, y)