Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Used Self more liberally #9

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 6 additions & 6 deletions src/cpu/cp0/reg_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ enum DataTransferPattern {

impl Default for DataTransferPattern {
fn default() -> Self {
DataTransferPattern::Normal
Self::Normal
}
}

impl From<u32> for DataTransferPattern {
fn from(value: u32) -> Self {
match (value >> 24) & 0b1111 {
0 => DataTransferPattern::Normal,
6 => DataTransferPattern::DxxDxx,
0 => Self::Normal,
6 => Self::DxxDxx,
_ => panic!("Invalid data transfer pattern (EP): {:#x}", value)
}
}
Expand All @@ -60,15 +60,15 @@ enum Endianness {

impl Default for Endianness {
fn default() -> Self {
Endianness::Big
Self::Big
}
}

impl From<u32> for Endianness {
fn from(value: u32) -> Self {
match (value >> 15) & 0b1 {
0 => Endianness::Little,
1 => Endianness::Big,
0 => Self::Little,
1 => Self::Big,
_ => unreachable!()
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/cpu/cp0/reg_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ enum TLBGeneralExceptionVectorLocation {

impl Default for TLBGeneralExceptionVectorLocation {
fn default() -> Self {
TLBGeneralExceptionVectorLocation::Normal
Self::Normal
}
}

impl From<u32> for TLBGeneralExceptionVectorLocation {
fn from(value: u32) -> Self {
match (value >> 22) & 0b1 {
0 => TLBGeneralExceptionVectorLocation::Normal,
1 => TLBGeneralExceptionVectorLocation::Bootstrap,
0 => Self::Normal,
1 => Self::Bootstrap,
_ => unreachable!()
}
}
Expand Down