this post was submitted on 10 Apr 2025
11 points (100.0% liked)

C++

1990 readers
1 users here now

The center for all discussion and news regarding C++.

Rules

founded 2 years ago
MODERATORS
 

I am trying to calculate a motor position from an encoder, however that does not really matter. I just checked godbolt.org to see if my inline function compiled into a single multiplication and was pretty disappointed that it didn't. I used -O3 for maximum optimization.

Does somebody know why it does not compile into a single function, or what I had to change to achieve that? You can find my code here: https://godbolt.org/z/qT9srfPT1 .

I know that it does not really matter, but I am curious.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 3 weeks ago* (last edited 3 weeks ago)

Very interesting comment. Thanks.