Skip to content

Commit

Permalink
Merge pull request #11 from tpoisonooo/fix-arm-32bit
Browse files Browse the repository at this point in the history
fix(ncnn-rs): compatible with arm 32bit
  • Loading branch information
tpoisonooo authored Dec 19, 2023
2 parents 7b29d11 + 727a470 commit 6f6250b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 0 additions & 1 deletion ncnn-bind/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

// Suppress bindgen test warnings
#![allow(deref_nullptr)]

Expand Down
12 changes: 10 additions & 2 deletions ncnn-rs/src/mat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,16 @@ impl Mat {
unsafe { ncnn_mat_get_elempack(self.ptr) }
}

pub fn cstep(&self) -> u64 {
unsafe { ncnn_mat_get_cstep(self.ptr) }
pub fn cstep(&self) -> usize {
#[cfg(target_pointer_width = "32")]
{
unsafe { ncnn_mat_get_cstep(self.ptr) as u32 as usize }
}

#[cfg(target_pointer_width = "64")]
{
unsafe { ncnn_mat_get_cstep(self.ptr) as u64 as usize }
}
}

/// Pointer to raw matrix data
Expand Down
8 changes: 6 additions & 2 deletions ncnn-rs/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ impl Drop for Net {
mod tests {
use super::*;

fn is_send<T: Send>() -> bool { true }
fn is_sync<T: Sync>() -> bool { true }
fn is_send<T: Send>() -> bool {
true
}
fn is_sync<T: Sync>() -> bool {

Check warning on line 75 in ncnn-rs/src/net.rs

View workflow job for this annotation

GitHub Actions / Build and test

function `is_sync` is never used
true
}

#[test]
fn load_not_exist_model() {
Expand Down

0 comments on commit 6f6250b

Please sign in to comment.