Skip to content

Chamaeleon64: Angles -- narrowing conversion of type warnings #226

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

Closed
henrygab opened this issue Dec 13, 2021 · 0 comments · Fixed by #228
Closed

Chamaeleon64: Angles -- narrowing conversion of type warnings #226

henrygab opened this issue Dec 13, 2021 · 0 comments · Fixed by #228
Assignees
Labels

Comments

@henrygab
Copy link
Collaborator

I think that these are not technically bugs, since the angle loops from [0..255] and then back to zero, which matches the behavior of uint8_t. However, it would be good to remove the warnings.

@jasoncoon -- can you confirm that the right fix is to store these values modulo 256?

Or, given that all the values range from 0..359, were the values accidentally left in degrees (rather than units where 256 == 360 degrees)?

Build warnings / errors

esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '256' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]
   const uint8_t  angles[NUM_PIXELS]              { 179, 192, 176, 175, 195, 212, 225, 210, 188, 158, 146, 141, 139, 211, 226, 187, 209, 233, 95, 85, 89, 226, 243, 244, 246, 256, 259, 274, 313, 274, 269, 278, 282, 298, 288, 299, 318, 299, 317, 312, 312, 326, 341, 340, 346, 31, 65, 79, 332, 345, 0, 15, 30, 43, 55, 61, 61, 41, 22, 27, 45, 54, 44, 40 };
                                                                                                                                                                          
                                                                                                                                                                          
          ^
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '259' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '274' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '313' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '274' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '269' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '278' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '282' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '298' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '288' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '299' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '318' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '299' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '317' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '312' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '312' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '326' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '341' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '340' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '346' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '332' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]
esp8266-fastled-webserver\Map.cpp:122:350: warning: narrowing conversion of '345' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]        
esp8266-fastled-webserver\Map.cpp:122:350: warning: large integer implicitly truncated to unsigned type [-Woverflow]

jasoncoon added a commit that referenced this issue Dec 13, 2021
Fixed a couple of typos.
@jasoncoon jasoncoon self-assigned this Dec 13, 2021
jasoncoon added a commit that referenced this issue Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants