chiark / gitweb /
macro: don't rely on C's downgrade-to-bool feature for numeric comparisons
authorLennart Poettering <lennart@poettering.net>
Wed, 11 Apr 2018 19:36:52 +0000 (21:36 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
src/basic/macro.h

index 6b3c3d04df9e85c997cdf5426547fa1d86288c0b..cd3ae8d3ab734cba17790739dc0e73f783e0c379 100644 (file)
@@ -350,7 +350,7 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
         ({                                              \
                 typeof(x) _x_ = (x);                    \
                 unsigned ans = 1;                       \
-                while (_x_ /= 10)                       \
+                while ((_x_ /= 10) != 0)                \
                         ans++;                          \
                 ans;                                    \
         })