Skip to content

Commit

Permalink
dep: remove sptr due to msrv bump
Browse files Browse the repository at this point in the history
  • Loading branch information
chyyran committed Oct 6, 2024
1 parent ed8bf63 commit ad04f5f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 19 deletions.
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions librashader-capi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ thiserror = "1.0.37"
paste = "1.0.9"
rustc-hash = "2.0.0"

sptr = "0.3.2"

glow = { workspace = true, optional = true }
ash = { workspace = true, optional = true }
cc = "=1.1.23"
Expand Down
4 changes: 2 additions & 2 deletions librashader-capi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ impl LibrashaderError {

macro_rules! assert_non_null {
(@EXPORT $value:ident) => {
if $value.is_null() || !$crate::ffi::ptr_is_aligned($value) {
if $value.is_null() || !$value.is_aligned() {
return $crate::error::LibrashaderError::InvalidParameter(stringify!($value)).export();
}
};
($value:ident) => {
if $value.is_null() || !$crate::ffi::ptr_is_aligned($value) {
if $value.is_null() || !$value.is_aligned() {
return Err($crate::error::LibrashaderError::InvalidParameter(
stringify!($value),
));
Expand Down
8 changes: 0 additions & 8 deletions librashader-capi/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,6 @@ pub unsafe fn boxed_slice_from_raw_parts<T>(ptr: *mut T, len: usize) -> Box<[T]>
unsafe { Box::from_raw(std::slice::from_raw_parts_mut(ptr, len)) }
}

pub fn ptr_is_aligned<T: Sized>(ptr: *const T) -> bool {
let align = std::mem::align_of::<T>();
if !align.is_power_of_two() {
panic!("is_aligned_to: align is not a power-of-two");
}
sptr::Strict::addr(ptr) & (align - 1) == 0
}

pub(crate) use extern_fn;
pub(crate) use ffi_body;
pub(crate) use wrap_ok;
Expand Down

0 comments on commit ad04f5f

Please sign in to comment.