Remove useless checks
This commit is contained in:
parent
aed3e7feaf
commit
70e28beb51
@ -11,9 +11,7 @@ unsigned int toIndex(Button button) {
|
|||||||
|
|
||||||
std::optional<Button> fromCoords(ButtonCoords button_coords) {
|
std::optional<Button> fromCoords(ButtonCoords button_coords) {
|
||||||
if (
|
if (
|
||||||
button_coords.x >= 0 and
|
|
||||||
button_coords.x < 4 and
|
button_coords.x < 4 and
|
||||||
button_coords.y >= 0 and
|
|
||||||
button_coords.y < 4
|
button_coords.y < 4
|
||||||
) {
|
) {
|
||||||
return static_cast<Button>(button_coords.x + 4*button_coords.y);
|
return static_cast<Button>(button_coords.x + 4*button_coords.y);
|
||||||
@ -23,7 +21,7 @@ std::optional<Button> fromCoords(ButtonCoords button_coords) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::optional<Button> fromIndex(unsigned int index) {
|
std::optional<Button> fromIndex(unsigned int index) {
|
||||||
if (index >= 0 and index < 16) {
|
if (index < 16) {
|
||||||
return static_cast<Button>(index);
|
return static_cast<Button>(index);
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user