Skip to content

Commit

Permalink
CpuidIterator: Better identifies the last sub-leaf
Browse files Browse the repository at this point in the history
There is no one definition of what is the last sub-leaf. It must be
determined by looking at what each leaf definition is. This may become
more complicated as more are added.
  • Loading branch information
andrewjj20 committed May 21, 2024
1 parent 35450f9 commit 5e9ed5d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,9 @@ impl CpuidIterator {
}

fn is_empty_leaf(result: &CpuidResult) -> bool {
let CpuidResult {
eax,
ebx,
ecx,
edx: _,
} = result;
let CpuidResult { eax, ebx, ecx, edx } = result;
// See
*eax == 0 && *ebx == 0 && *ecx & 0x0000FF00 == 0
*eax == 0 && *ebx == 0 && ((*ecx == 0 && *edx == 0) || (*ecx != 0 && *ecx & 0xFFFFFF00 == 0))
}

impl Iterator for CpuidIterator {
Expand Down

0 comments on commit 5e9ed5d

Please sign in to comment.