URI: 
       Fix warnings - blind - suckless command-line video editing utility
  HTML git clone git://git.suckless.org/blind
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit f3cde9060c57320c9ed7a9b4bcb494bd411fb1f4
   DIR parent 42dbdaca968f29457eac192cea065551b496703f
  HTML Author: Mattias Andrée <maandree@kth.se>
       Date:   Sat, 15 Jul 2017 01:04:14 +0200
       
       Fix warnings
       
       Signed-off-by: Mattias Andrée <maandree@kth.se>
       
       Diffstat:
         M src/blind-arithm.c                  |       9 ---------
         M src/blind-cross-product.c           |       9 ---------
         M src/blind-dot-product.c             |       9 ---------
         M src/blind-find-rectangle.c          |       2 +-
         M src/blind-from-named.c              |       4 ++--
         M src/blind-hexagon-tessellation.c    |       4 ++--
         M src/blind-kernel.c                  |       5 -----
         M src/blind-mosaic-edges.c            |       2 +-
         M src/blind-mosaic.c                  |       2 +-
         M src/blind-multiply-matrices.c       |       2 +-
         M src/blind-quaternion-product.c      |       9 ---------
         M src/blind-sinc-wave.c               |      10 +++++-----
         M src/blind-spiral-gradient.c         |       4 ++--
         M src/blind-tee.c                     |       4 ++--
         M src/blind-to-named.c                |       4 ++--
         M src/blind-triangular-wave.c         |      10 +++++-----
         M src/blind-vector-projection.c       |       9 ---------
         M src/common.h                        |       6 ++++++
         M src/util.c                          |      12 ++++++------
         M src/util/io.h                       |      12 ++++++------
         M src/util/to.h                       |       8 ++++----
         M src/video-math.h                    |      70 ++++++++++++++++----------------
       
       22 files changed, 81 insertions(+), 125 deletions(-)
       ---
   DIR diff --git a/src/blind-arithm.c b/src/blind-arithm.c
       @@ -28,11 +28,6 @@ typedef void (*process_func)(struct stream *left, struct stream *right, size_t n
                                rh = ((TYPE *)(right->buf + i))[CHI],\
                                (ALGO)), 0) : 0)
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic push
       -# pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
       -#endif
       -
        #define X(NAME, ALGO, PIXFMT, TYPE)\
                static void\
                process_##PIXFMT##_##NAME(struct stream *left, struct stream *right, size_t n)\
       @@ -50,10 +45,6 @@ LIST_OPERATORS(xyza, double)
        LIST_OPERATORS(xyzaf, float)
        #undef X
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic pop
       -#endif
       -
        static process_func
        get_process_xyza(const char *operation)
        {
   DIR diff --git a/src/blind-cross-product.c b/src/blind-cross-product.c
       @@ -3,11 +3,6 @@
        
        USAGE("right-hand-stream")
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic push
       -# pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
       -#endif
       -
        #define PROCESS(TYPE, SUFFIX)\
                static void\
                process_##SUFFIX(struct stream *left, struct stream *right, size_t n)\
       @@ -33,10 +28,6 @@ USAGE("right-hand-stream")
        PROCESS(double, lf)
        PROCESS(float, f)
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic pop
       -#endif
       -
        int
        main(int argc, char *argv[])
        {
   DIR diff --git a/src/blind-dot-product.c b/src/blind-dot-product.c
       @@ -3,11 +3,6 @@
        
        USAGE("right-hand-stream")
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic push
       -# pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
       -#endif
       -
        #define PROCESS(TYPE, SUFFIX)\
                static void\
                process_##SUFFIX(struct stream *left, struct stream *right, size_t n)\
       @@ -26,10 +21,6 @@ USAGE("right-hand-stream")
        PROCESS(double, lf)
        PROCESS(float, f)
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic pop
       -#endif
       -
        int
        main(int argc, char *argv[])
        {
   DIR diff --git a/src/blind-find-rectangle.c b/src/blind-find-rectangle.c
       @@ -75,7 +75,7 @@ int
        main(int argc, char *argv[])
        {
                double colour_lf[4];
       -        double colour_f[4];
       +        float colour_f[4];
        
                ARGBEGIN {
                case 'a':
   DIR diff --git a/src/blind-from-named.c b/src/blind-from-named.c
       @@ -60,7 +60,7 @@ sendfile(int outfd, int infd, off_t *offset, size_t count)
                                break;
                        ret += r;
                        for (p = 0; p < r; p += w) {
       -                        w = write(outfd, buf + p, r - p);
       +                        w = write(outfd, buf + p, (size_t)(r - p));
                                if (w < 0)
                                        eprintf("write <stdout>:");
                        }
       @@ -99,7 +99,7 @@ main(int argc, char *argv[])
        
                memset(&addr, 0, sizeof(addr));
                addr.sun_family = AF_UNIX;
       -        if (strlen(argv[0]) + 1 + abstract > sizeof(addr.sun_path)) {
       +        if (strlen(argv[0]) + (size_t)(1 + abstract) > sizeof(addr.sun_path)) {
                        errno = ENAMETOOLONG;
                        eprintf("%s:", argv[0]);
                }
   DIR diff --git a/src/blind-hexagon-tessellation.c b/src/blind-hexagon-tessellation.c
       @@ -57,7 +57,7 @@ main(int argc, char *argv[])
                        eprintf("pixel format %s is not supported, try xyza\n", pixfmt);
        
                strcpy(stream.pixfmt, pixfmt);
       -        stream.width  = (size_t)(diameter * sqrt(3.));
       +        stream.width  = (size_t)((double)diameter * sqrt(3.));
                stream.height = diameter * 3 / 2;
                fprint_stream_head(stdout, &stream);
                efflush(stdout, "<stdout>");
       @@ -100,7 +100,7 @@ main(int argc, char *argv[])
                                } else {
                                        k = (stream.width <= x * 4 && x * 4 < stream.width * 3) + 2;
                                }
       -                        ewriteall(STDOUT_FILENO, colours + k * pixwidth, pixwidth, "<stdout>");
       +                        ewriteall(STDOUT_FILENO, colours + (size_t)k * pixwidth, pixwidth, "<stdout>");
                        }
                }
        
   DIR diff --git a/src/blind-kernel.c b/src/blind-kernel.c
       @@ -1,11 +1,6 @@
        /* See LICENSE file for copyright and license details. */
        #include "common.h"
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic push
       -# pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
       -#endif
       -
        USAGE("[-xyza] kernel [parameter] ...")
        
        #define SUBUSAGE(FORMAT)          "usage: %s [-xyza] " FORMAT, argv0
   DIR diff --git a/src/blind-mosaic-edges.c b/src/blind-mosaic-edges.c
       @@ -99,7 +99,7 @@ main(int argc, char *argv[])
        
                                continue;
                        at_edge:
       -                        edges[i >> 3] |= 1 << (i & 7);
       +                        edges[i >> 3] |= (char)(1 << (i & 7));
                        }
                        for (i = 0; i < n; i++) {
                                v = (edges[i >> 3] >> (i & 7)) & 1;
   DIR diff --git a/src/blind-mosaic.c b/src/blind-mosaic.c
       @@ -114,7 +114,7 @@ search_lf(void *restrict output, void *restrict mbuf, struct stream *mosaic,
        
        static void
        search_f(void *restrict output, void *restrict mbuf, struct stream *mosaic,
       -         size_t x, size_t y, size_t index, double ch1, double ch2, double ch3, double ch4)
       +         size_t x, size_t y, size_t index, float ch1, float ch2, float ch3, float ch4)
        {
                SEARCH(float, search_f);
        }
   DIR diff --git a/src/blind-multiply-matrices.c b/src/blind-multiply-matrices.c
       @@ -82,7 +82,7 @@ main(int argc, char *argv[])
                        usage();
        
                if (natural) {
       -                rev_argv = alloca(argc * sizeof(*rev_argv));
       +                rev_argv = alloca((size_t)argc * sizeof(*rev_argv));
                        for (j = 0; j < argc; j++)
                                rev_argv[j] = argv[argc - 1 - j];
                        argv = rev_argv;
   DIR diff --git a/src/blind-quaternion-product.c b/src/blind-quaternion-product.c
       @@ -3,11 +3,6 @@
        
        USAGE("right-hand-stream")
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic push
       -# pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
       -#endif
       -
        #define PROCESS(TYPE, SUFFIX)\
                static void\
                process_##SUFFIX(struct stream *left, struct stream *right, size_t n)\
       @@ -33,10 +28,6 @@ USAGE("right-hand-stream")
        PROCESS(double, lf)
        PROCESS(float, f)
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic pop
       -#endif
       -
        int
        main(int argc, char *argv[])
        {
   DIR diff --git a/src/blind-sinc-wave.c b/src/blind-sinc-wave.c
       @@ -36,7 +36,7 @@ static int equal = 0;
                                if (equal) {\
                                        for (i = 0; i < n; i++) {\
                                                a = ((TYPE *)(grad->buf))[4 * i + 3];\
       -                                        a = (a ? sin(a + theta0y) / a : sin(a + theta0y)) / 2 + 0.5;\
       +                                        a = (a ? sin(a + theta0y) / a : sin(a + theta0y)) / 2 + (TYPE)0.5;\
                                                ((TYPE *)(grad->buf))[4 * i + 0] = a;\
                                                ((TYPE *)(grad->buf))[4 * i + 1] = a;\
                                                ((TYPE *)(grad->buf))[4 * i + 2] = a;\
       @@ -48,10 +48,10 @@ static int equal = 0;
                                                y = ((TYPE *)(grad->buf))[4 * i + 1];\
                                                z = ((TYPE *)(grad->buf))[4 * i + 2];\
                                                a = ((TYPE *)(grad->buf))[4 * i + 3];\
       -                                        x = (x ? sin(x + theta0x) / x : sin(x + theta0x)) / 2 + 0.5;\
       -                                        y = (y ? sin(y + theta0y) / y : sin(y + theta0y)) / 2 + 0.5;\
       -                                        z = (z ? sin(z + theta0z) / z : sin(z + theta0z)) / 2 + 0.5;\
       -                                        a = (a ? sin(a + theta0a) / a : sin(a + theta0a)) / 2 + 0.5;\
       +                                        x = (x ? sin(x + theta0x) / x : sin(x + theta0x)) / 2 + (TYPE)0.5;\
       +                                        y = (y ? sin(y + theta0y) / y : sin(y + theta0y)) / 2 + (TYPE)0.5;\
       +                                        z = (z ? sin(z + theta0z) / z : sin(z + theta0z)) / 2 + (TYPE)0.5;\
       +                                        a = (a ? sin(a + theta0a) / a : sin(a + theta0a)) / 2 + (TYPE)0.5;\
                                                ((TYPE *)(grad->buf))[4 * i + 0] = x;\
                                                ((TYPE *)(grad->buf))[4 * i + 1] = y;\
                                                ((TYPE *)(grad->buf))[4 * i + 2] = z;\
   DIR diff --git a/src/blind-spiral-gradient.c b/src/blind-spiral-gradient.c
       @@ -60,7 +60,7 @@ static int with_vector;
                                y2 -= y1;\
                                u = atan2(y2, x2);\
                                b = sqrt(x2 * x2 + y2 * y2);\
       -                        b *= spirals;\
       +                        b *= (TYPE)spirals;\
                                if (logarithmic)\
                                        b = log(b);\
                                b /= pow(2 * (TYPE)M_PI, e);\
       @@ -100,7 +100,7 @@ static int with_vector;
                                                        r = (r - v) / (2 * (TYPE)M_PI);\
                                                }\
                                                if (angle)\
       -                                                r = (int)(r + 1) + v / (2 * (TYPE)M_PI);\
       +                                                r = (TYPE)(int)(r + 1) + v / (2 * (TYPE)M_PI); \
                                                else\
                                                        r = mod(r, 1 / (TYPE)spirals) * (TYPE)spirals + r - mod(r, (TYPE)1);\
                                                buf[ptr][0] = buf[ptr][1] = buf[ptr][2] = buf[ptr][3] = r;\
   DIR diff --git a/src/blind-tee.c b/src/blind-tee.c
       @@ -11,7 +11,7 @@ int
        main(int argc, char *argv[])
        {
                char buf[PIPE_BUF];
       -        int *fds = alloca(argc * sizeof(*fds));
       +        int *fds = alloca((size_t)argc * sizeof(*fds));
                size_t i, n = 0, done;
                ssize_t r, w, *ps;
        
       @@ -34,7 +34,7 @@ main(int argc, char *argv[])
                                for (i = 0; i < n; i++) {
                                        if (ps[i] == r)
                                                continue;
       -                                w = write(fds[i], buf + ps[i], r - ps[i]);
       +                                w = write(fds[i], buf + ps[i], (size_t)(r - ps[i]));
                                        if (w < 0) {
                                                close(fds[i]);
                                                n--;
   DIR diff --git a/src/blind-to-named.c b/src/blind-to-named.c
       @@ -28,7 +28,7 @@ esend_fd(int sock, int fd)
                cmsg->cmsg_type = SCM_RIGHTS;
                memcpy(CMSG_DATA(cmsg), &fd, sizeof(fd));
        
       -        if (sendmsg(sock, &msg, 0) != iov.iov_len)
       +        if (sendmsg(sock, &msg, 0) != (ssize_t)iov.iov_len)
                        eprintf("sendmsg:");
        }
        
       @@ -51,7 +51,7 @@ main(int argc, char *argv[])
        
                memset(&addr, 0, sizeof(addr));
                addr.sun_family = AF_UNIX;
       -        if (strlen(argv[0]) + 1 + abstract > sizeof(addr.sun_path)) {
       +        if (strlen(argv[0]) + (size_t)(1 + abstract) > sizeof(addr.sun_path)) {
                        errno = ENAMETOOLONG;
                        eprintf("%s:", argv[0]);
                }
   DIR diff --git a/src/blind-triangular-wave.c b/src/blind-triangular-wave.c
       @@ -21,7 +21,7 @@ static int spiral = 0;
                                                a = posmod(a, (TYPE)2);\
                                                a = a > 1 ? 2 - a : a;\
                                                if (spiral)\
       -                                                a = (a > 0.5 ? 1 - a : a) * 2;\
       +                                                a = (a > (TYPE)0.5 ? 1 - a : a) * 2; \
                                                ((TYPE *)(stream->buf))[4 * i + 0] = a;\
                                                ((TYPE *)(stream->buf))[4 * i + 1] = a;\
                                                ((TYPE *)(stream->buf))[4 * i + 2] = a;\
       @@ -42,10 +42,10 @@ static int spiral = 0;
                                                z = z > 1 ? 2 - z : z;\
                                                a = a > 1 ? 2 - a : a;\
                                                if (spiral) {\
       -                                                x = (x > 0.5 ? 1 - x : x) * 2;\
       -                                                y = (y > 0.5 ? 1 - y : y) * 2;\
       -                                                z = (z > 0.5 ? 1 - z : z) * 2;\
       -                                                a = (a > 0.5 ? 1 - a : a) * 2;\
       +                                                x = (x > (TYPE)0.5 ? 1 - x : x) * 2;\
       +                                                y = (y > (TYPE)0.5 ? 1 - y : y) * 2;\
       +                                                z = (z > (TYPE)0.5 ? 1 - z : z) * 2;\
       +                                                a = (a > (TYPE)0.5 ? 1 - a : a) * 2;\
                                                }\
                                                ((TYPE *)(stream->buf))[4 * i + 0] = x;\
                                                ((TYPE *)(stream->buf))[4 * i + 1] = y;\
   DIR diff --git a/src/blind-vector-projection.c b/src/blind-vector-projection.c
       @@ -5,11 +5,6 @@ USAGE("[-r | -s] plane-stream")
        
        static int level = 1;
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic push
       -# pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
       -#endif
       -
        #define PROCESS(TYPE, SUFFIX)\
                static void\
                process_##SUFFIX(struct stream *left, struct stream *right, size_t n)\
       @@ -46,10 +41,6 @@ static int level = 1;
        PROCESS(double, lf)
        PROCESS(float, f)
        
       -#if defined(__GNUC__) && !defined(__clang__)
       -# pragma GCC diagnostic pop
       -#endif
       -
        int
        main(int argc, char *argv[])
        {
   DIR diff --git a/src/common.h b/src/common.h
       @@ -7,8 +7,14 @@
        # pragma clang diagnostic ignored "-Wfloat-equal"
        # pragma clang diagnostic ignored "-Wformat-nonliteral"
        # pragma clang diagnostic ignored "-Wcovered-switch-default"
       +# pragma clang diagnostic ignored "-Wfloat-conversion"
       +# pragma clang diagnostic ignored "-Wabsolute-value"
       +# pragma clang diagnostic ignored "-Wconditional-uninitialized"
       +# pragma clang diagnostic ignored "-Wunreachable-code-return"
        #elif defined(__GNUC__)
        # pragma GCC diagnostic ignored "-Wfloat-equal"
       +# pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
       +# pragma GCC diagnostic ignored "-Wfloat-conversion"
        #endif
        
        #include "stream.h"
   DIR diff --git a/src/util.c b/src/util.c
       @@ -94,9 +94,9 @@ erange:
        
        
        int
       -writeall(int fd, void *buf, size_t n)
       +writeall(int fd, const void *buf, size_t n)
        {
       -        char *buffer = buf;
       +        const char *buffer = buf;
                ssize_t r;
                while (n) {
                        r = write(fd, buffer, n);
       @@ -122,13 +122,13 @@ readall(int fd, void *buf, size_t n)
                                break;
                        ptr += (size_t)r;
                }
       -        return ptr;
       +        return (ssize_t)ptr;
        }
        
        int
       -pwriteall(int fd, void *buf, size_t n, off_t ptr)
       +pwriteall(int fd, const void *buf, size_t n, off_t ptr)
        {
       -        char *buffer = buf;
       +        const char *buffer = buf;
                ssize_t r;
                while (n) {
                        r = pwrite(fd, buffer, n, (off_t)ptr);
       @@ -142,7 +142,7 @@ pwriteall(int fd, void *buf, size_t n, off_t ptr)
        }
        
        int
       -writezeroes(int fd, void *buf, size_t bufsize, size_t n)
       +writezeroes(int fd, const void *buf, size_t bufsize, size_t n)
        {
                size_t p, m;
                for (p = 0; p < n; p += m) {
   DIR diff --git a/src/util/io.h b/src/util/io.h
       @@ -20,10 +20,10 @@
        #define ewritezeroes(...)  enwritezeroes(1, __VA_ARGS__)
        #define egetfile(...)      engetfile(1, __VA_ARGS__)
        
       -int writeall(int fd, void *buf, size_t n);
       +int writeall(int fd, const void *buf, size_t n);
        
        static inline void
       -enwriteall(int status, int fd, void *buf, size_t n, const char *fname)
       +enwriteall(int status, int fd, const void *buf, size_t n, const char *fname)
        {
                if (writeall(fd, buf, n))
                        enprintf(status, "write %s:", fname);
       @@ -40,19 +40,19 @@ enreadall(int status, int fd, void *buf, size_t n, const char *fname)
                return (size_t)r;
        }
        
       -int pwriteall(int fd, void *buf, size_t n, off_t ptr);
       +int pwriteall(int fd, const void *buf, size_t n, off_t ptr);
        
        static inline void
       -enpwriteall(int status, int fd, void *buf, size_t n, off_t ptr, const char *fname)
       +enpwriteall(int status, int fd, const void *buf, size_t n, off_t ptr, const char *fname)
        {
                if (pwriteall(fd, buf, n, ptr))
                        enprintf(status, "pwrite %s:", fname);
        }
        
       -int writezeroes(int fd, void *buf, size_t bufsize, size_t n);
       +int writezeroes(int fd, const void *buf, size_t bufsize, size_t n);
        
        static inline void
       -enwritezeroes(int status, int fd, void *buf, size_t bufsize, size_t n, const char *fname)
       +enwritezeroes(int status, int fd, const void *buf, size_t bufsize, size_t n, const char *fname)
        {
                if (writezeroes(fd, buf, bufsize, n))
                        enprintf(status, "write %s:", fname);
   DIR diff --git a/src/util/to.h b/src/util/to.h
       @@ -25,7 +25,7 @@ DEF_STR_TO_INT(toi, int, tolli, long long int, "i")
        #define toji tolli
        
        #define DEF_STR_TO_INT(FNAME, TYPE, PRI)\
       -        static inline TYPE\
       +        static TYPE\
                en##FNAME##_flag(int status, int flag, const char *s, TYPE min, TYPE max)\
                {\
                        TYPE ret = 0;\
       @@ -42,7 +42,7 @@ DEF_STR_TO_INT(toi, int, tolli, long long int, "i")
                        return en##FNAME##_flag(1, flag, s, min, max);\
                }\
                \
       -        static inline TYPE\
       +        static TYPE\
                en##FNAME##_arg(int status, const char *name, const char *s, TYPE min, TYPE max)\
                {\
                        TYPE ret = 0;\
       @@ -100,7 +100,7 @@ DEF_STR_TO_INT(toi, int, "i")
                        return 0;\
                }\
                \
       -        static inline TYPE\
       +        static TYPE\
                en##FNAME##_flag(int status, int flag, const char *s)\
                {\
                        TYPE ret = 0;\
       @@ -115,7 +115,7 @@ DEF_STR_TO_INT(toi, int, "i")
                        return en##FNAME##_flag(1, flag, s);\
                }\
                \
       -        static inline TYPE\
       +        static TYPE\
                en##FNAME##_arg(int status, const char *name, const char *s)\
                {\
                        TYPE ret = 0;\
   DIR diff --git a/src/video-math.h b/src/video-math.h
       @@ -2,7 +2,7 @@
        #include <math.h>
        
        static inline double
       -nnpow(double a, double b)
       +nnpow_d(double a, double b)
        {
                int neg = a < 0;
                a = pow(neg ? -a : a, b);
       @@ -10,7 +10,7 @@ nnpow(double a, double b)
        }
        
        static inline float
       -nnpowf(float a, float b)
       +nnpow_f(float a, float b)
        {
                int neg = a < 0;
                a = powf(neg ? -a : a, b);
       @@ -18,61 +18,61 @@ nnpowf(float a, float b)
        }
        
        static inline double
       -posmod(double a, double b)
       +posmod_d(double a, double b)
        {
                double x = fmod(a, b);
                return x < 0 ? x + b : x;
        }
        
        static inline float
       -posmodf(float a, float b)
       +posmod_f(float a, float b)
        {
                float x = fmodf(a, b);
                return x < 0 ? x + b : x;
        }
        
        static inline double
       -degsin(double u)
       +degsin_d(double u)
        {
                if (!fmod(u, 90)) {
       -                int64_t v = u;
       +                int64_t v = (int64_t)u;
                        v = ((v / 90) % 4 + 4) % 4;
                        return ((double[]){0, 1, 0, -1})[v];
                }
       -        return sin(u * (M_PI / 180.0));
       +        return sin(u * (M_PI / 180));
        }
        
        static inline float
       -degsinf(float u)
       +degsin_f(float u)
        {
                if (!fmodf(u, 90)) {
       -                int64_t v = u;
       +                int64_t v = (int64_t)u;
                        v = ((v / 90) % 4 + 4) % 4;
                        return ((float[]){0, 1, 0, -1})[v];
                }
       -        return sin(u * (float)(M_PI / 180.0));
       +        return sinf(u * (float)(M_PI / 180));
        }
        
        static inline double
       -degcos(double u)
       +degcos_d(double u)
        {
                if (!fmod(u, 90)) {
       -                int64_t v = u;
       +                int64_t v = (int64_t)u;
                        v = ((v / 90) % 4 + 4) % 4;
                        return ((double[]){1, 0, -1, 0})[v];
                }
       -        return cos(u * (M_PI / 180.0));
       +        return cos(u * (M_PI / 180));
        }
        
        static inline float
       -degcosf(float u)
       +degcos_f(float u)
        {
                if (!fmodf(u, 90)) {
       -                int64_t v = u;
       +                int64_t v = (int64_t)u;
                        v = ((v / 90) % 4 + 4) % 4;
                        return ((float[]){1, 0, -1, 0})[v];
                }
       -        return cos(u * (float)(M_PI / 180.0));
       +        return cosf(u * (float)(M_PI / 180));
        }
        
        #define GENERIC(TYPE, FUNC, ...)\
       @@ -101,25 +101,25 @@ degcosf(float u)
                                                        GENERIC(double, FUNC##_d, A, __VA_ARGS__), \
                                                        GENERIC(float,  FUNC##_f, A, __VA_ARGS__)))
        
       -#define pow(...)         MATH_GENERIC_N(pow,      __VA_ARGS__)
       -#define log2(...)        MATH_GENERIC_1(log2,     __VA_ARGS__)
       -#define log(...)         MATH_GENERIC_1(log,      __VA_ARGS__)
       -#define abs(...)         MATH_GENERIC_1(fabs,     __VA_ARGS__)
       -#define sqrt(...)        MATH_GENERIC_1(sqrt,     __VA_ARGS__)
       -#define exp(...)         MATH_GENERIC_1(exp,      __VA_ARGS__)
       -#define g_isnan(...)     MATH_GENERIC_1(isnan,    __VA_ARGS__)
       -#define g_isinf(...)     MATH_GENERIC_1(isinf,    __VA_ARGS__)
       -#define g_isfinite(...)  MATH_GENERIC_1(isfinite, __VA_ARGS__)
       -#define nnpow(...)       MATH_GENERIC_N(nnpow,    __VA_ARGS__)
       -#define mod(...)         MATH_GENERIC_N(fmod,     __VA_ARGS__)
       -#define posmod(...)      MATH_GENERIC_N(posmod,   __VA_ARGS__)
       -#define cos(...)         MATH_GENERIC_1(cos,      __VA_ARGS__)
       -#define sin(...)         MATH_GENERIC_1(sin,      __VA_ARGS__)
       -#define tan(...)         MATH_GENERIC_1(tan,      __VA_ARGS__)
       -#define atan2(...)       MATH_GENERIC_N(atan2,    __VA_ARGS__)
       -#define degcos(...)      MATH_GENERIC_1(degcos,   __VA_ARGS__)
       -#define degsin(...)      MATH_GENERIC_1(degsin,   __VA_ARGS__)
       -
       +#define pow(...)        MATH_GENERIC_N(pow,      __VA_ARGS__)
       +#define log2(...)       MATH_GENERIC_1(log2,     __VA_ARGS__)
       +#define log(...)        MATH_GENERIC_1(log,      __VA_ARGS__)
       +#define abs(...)        MATH_GENERIC_1(fabs,     __VA_ARGS__)
       +#define sqrt(...)       MATH_GENERIC_1(sqrt,     __VA_ARGS__)
       +#define exp(...)        MATH_GENERIC_1(exp,      __VA_ARGS__)
       +#define g_isnan(...)    MATH_GENERIC_1(isnan,    __VA_ARGS__)
       +#define g_isinf(...)    MATH_GENERIC_1(isinf,    __VA_ARGS__)
       +#define g_isfinite(...) MATH_GENERIC_1(isfinite, __VA_ARGS__)
       +#define mod(...)        MATH_GENERIC_N(fmod,     __VA_ARGS__)
       +#define cos(...)        MATH_GENERIC_1(cos,      __VA_ARGS__)
       +#define sin(...)        MATH_GENERIC_1(sin,      __VA_ARGS__)
       +#define tan(...)        MATH_GENERIC_1(tan,      __VA_ARGS__)
       +#define atan2(...)      MATH_GENERIC_N(atan2,    __VA_ARGS__)
       +
       +#define nnpow(...)       BLIND_GENERIC_N(nnpow,       __VA_ARGS__)
       +#define posmod(...)      BLIND_GENERIC_N(posmod,      __VA_ARGS__)
       +#define degcos(...)      BLIND_GENERIC_1(degcos,      __VA_ARGS__)
       +#define degsin(...)      BLIND_GENERIC_1(degsin,      __VA_ARGS__)
        #define srgb_encode(...) BLIND_GENERIC_1(srgb_encode, __VA_ARGS__)
        #define srgb_decode(...) BLIND_GENERIC_1(srgb_decode, __VA_ARGS__)