diff --git a/ColorConvertBenchmark/ColorConvertBenchmark.ino b/ColorConvertBenchmark/ColorConvertBenchmark.ino new file mode 100644 index 0000000..d5095e8 --- /dev/null +++ b/ColorConvertBenchmark/ColorConvertBenchmark.ino @@ -0,0 +1,23 @@ +void setup() { + +} + +void loop() { + convert1(129); + convert2(129); + convert3(129); +} + + +int convert1(int color_in) { + return 4096 / ( 256 / color_in); +} + +int convert2(int color_in) { + return color_in << 4; +} + +int convert3(int color_in) { + return (int) (4096 / ( 256 / (float) color_in)); +} +