Skip to content

remove abs() from radius #7890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2023
Merged

Conversation

FoamyGuy
Copy link
Collaborator

Attempt to resolve #7883

This removes the unnecessary absolute value call from radius variable.

Honestly I don't quite follow the rest of the conversation about x and y calculations and casting. If there are other proposed changes that need to be tested out I'm happy to try those if someone can point me more specifically to what the code would look like.

int16_t radius = abs(self->radius);
int16_t radius = self->radius;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only thing I'd currently advocate for changing in here. This change looks great to me, thanks 😄

You could use the value as-is instead of the typecast it's doing to a signed integer but no big deal either way imo:

Suggested change
int16_t radius = abs(self->radius);
int16_t radius = self->radius;
uint16_t radius = self->radius;

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explications. We can leave the rest as is.

@dhalbert dhalbert merged commit b5a26c7 into adafruit:main Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix abs() warning in vectorio/Circle.c
3 participants