Skip to content

Commit 4bceea5

Browse files
committed
Working around an 8-vs-16 -bit math issue.
1 parent 8997020 commit 4bceea5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hsv2rgb.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,8 @@ CHSV rgb2hsv_approximate( const CRGB& rgb)
550550
// this part could probably use refinement/rethinking,
551551
// (but it doesn't overflow & wrap anymore)
552552
uint16_t s16;
553-
s16 = (s * 256) / v;
553+
s16 = (s * 256);
554+
s16 /= v;
554555
if( s16 < 256) {
555556
s = s16;
556557
} else {

0 commit comments

Comments
 (0)