Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ncnn-rs): compatible with arm 32bit #11

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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

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
Loading