Skip to content

Commit

Permalink
Fix incorrect Sysno::len() on mips
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwhite committed Jun 29, 2022
1 parent e197cbe commit 9522ad2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/arch/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ macro_rules! syscall_enum {

/// Returns the length of the syscall table, including any gaps.
pub const fn len() -> usize {
Self::last().id() as usize + 1
(Self::last().id() - Self::first().id()) as usize + 1
}

/// Returns an iterator that iterates over all possible syscalls.
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,10 @@ mod tests {
#[cfg(target_arch = "x86")]
assert_eq!(Sysno::first(), Sysno::restart_syscall);
}

#[test]
fn test_syscall_len() {
assert!(Sysno::len() > 300);
assert!(Sysno::len() < 1000);
}
}

0 comments on commit 9522ad2

Please sign in to comment.