diff --git a/src/cmath.h b/src/cmath.h new file mode 100644 index 0000000..bf876b3 --- /dev/null +++ b/src/cmath.h @@ -0,0 +1,17 @@ +// Provide an uniform interface for basic math functions between AVR libc and newer +// standards that support +#pragma once + +#ifndef __AVR__ + #include +#else + + // AVR libc doesn't support cmath + #include + + // Use builtin functions for min/max/abs + #define min(a, b) __builtin_min((a, b)) + #define max(a, b) __builtin_max((a, b)) + #define abs(n) __builtin_abs((n)) + +#endif