shithub: puzzles

Download patch

ref: 712abb7719440e132750fedf1bab60db9c1023fd
parent: 43bea5f6f20b4a58b083ccb0b380e78180017128
author: Ben Harris <bjh21@bjh21.me.uk>
date: Mon Dec 12 16:09:32 EST 2022

Add an assertion that all colours are within range

Because I know I'm going to mess this up at some point.

--- a/midend.c
+++ b/midend.c
@@ -1348,6 +1348,9 @@
                 ret[i*3 + 1] = g / 255.0F;
                 ret[i*3 + 2] = b / 255.0F;
             }
+            assert(0.0F <= ret[i*3 + 0] && ret[i*3 + 0] <= 1.0F);
+            assert(0.0F <= ret[i*3 + 1] && ret[i*3 + 1] <= 1.0F);
+            assert(0.0F <= ret[i*3 + 2] && ret[i*3 + 2] <= 1.0F);
         }
     }