Skip to content

Commit 77d5f3c

Browse files
authored
fix: Support aarch64 Linux (#40)
1 parent d354abe commit 77d5f3c

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<br>
88

9-
- Offers safe, direct Rust wrappers for the entire MuJoCo API.
9+
- Offers safe, low-level Rust wrappers for the entire MuJoCo API.
1010
- Provides getters for all struct fields and setters for user-modifiable fields,
1111
instead of allowing direct field access.
1212
- Implements automatic resource management via Rust's RAII pattern.

src/helper.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ pub(crate) fn array_flatslice<T, const M: usize, const N: usize>(
77

88
pub(crate) fn copy_str_to_c_chararray<const N: usize>(
99
s: &str,
10-
c_array: &mut [i8; N],
10+
c_array: &mut [std::ffi::c_char; N],
1111
) {
1212
let c_str = std::ffi::CString::new(s).expect("string must not contain internal null bytes");
1313
let bytes = c_str.into_bytes_with_nul();
1414
assert!(bytes.len() <= N, "string must be less than {N} bytes long");
15-
bytes.iter().enumerate().for_each(|(i, &b)| {c_array[i] = b as i8});
15+
bytes.iter().enumerate().for_each(|(i, &b)| {c_array[i] = b as std::ffi::c_char});
1616
c_array[bytes.len()..].fill(0); // fill the rest with zeros
1717
}
1818

src/types/visualization.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ macro_rules! chars {
456456
let bytes = $name.as_bytes();
457457
let (len, limit) = (bytes.len(), self.$name.len() - 1);
458458
assert!(len <= limit, "{}: `{len}` is too long, max {limit} bytes", stringify!($name));
459-
bytes.iter().enumerate().for_each(|(i, &b)| self.$name[i] = b as i8);
459+
bytes.iter().enumerate().for_each(|(i, &b)| self.$name[i] = b as std::ffi::c_char);
460460
self.$name[bytes.len()] = 0; // null-terminate
461461
self
462462
}
@@ -481,7 +481,7 @@ impl mjvFigure {
481481
assert!(index < mjMAXLINE, "`set_linename`: too large index `{index}`, must be index < {mjMAXLINE}");
482482
let (len, limit) = (name.as_bytes().len(), self.linename[index].len() - 1);
483483
assert!(len <= limit, "Line name `{name}` is too long, max {limit} bytes");
484-
name.as_bytes().iter().enumerate().for_each(|(i, &b)| self.linename[index][i] = b as i8);
484+
name.as_bytes().iter().enumerate().for_each(|(i, &b)| self.linename[index][i] = b as std::ffi::c_char);
485485
self.linename[index][len] = 0; // null-terminate
486486
self
487487
}

0 commit comments

Comments
 (0)