-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
Global: Change division to multiplication #26855
base: master
Are you sure you want to change the base?
Global: Change division to multiplication #26855
Conversation
Have you checked the assembly output? There is a high chance the compiler is already making this optimisation. |
We don't let the compiler do this as the results can change. I think that's We can choose to do it ourselves, of course, and yes, this PR does change the compiler output to do muls rather than divs. |
b480a4e
to
a5de365
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -603,7 +603,7 @@ int decodeECU_TelemetrySlow1PacketStructure(const void* _pg_pkt, ECU_TelemetrySl | |||
|
|||
// Input voltage in Volts | |||
// Range of voltage is 0.0f to 25.5f. | |||
_pg_user->voltage = float32ScaledFrom1UnsignedBytes(_pg_data, &_pg_byteindex, 0.0f, 1.0f/10.0f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a generated file, should not be modified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reverted the changes to the piccolo_protocol.
Can be merged once the piccolocan patches are removed |
a5de365
to
a0b9a90
Compare
a0b9a90
to
be67cd5
Compare
@muramura please rebase |
The STM32 has fewer clocks for multiplication than for division.