---
 src/journal/journald-rate-limit.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/journal/journald-rate-limit.c 
b/src/journal/journald-rate-limit.c
index 8bd6847..e33b595 100644
--- a/src/journal/journald-rate-limit.c
+++ b/src/journal/journald-rate-limit.c
@@ -170,19 +170,9 @@ fail:
         return NULL;
 }
 
-static uint64_t u64log2(uint64_t n) {
-        unsigned r;
-
-        if (n <= 1)
-                return 0;
-
-        r = 0;
-        for (;;) {
-                n = n >> 1;
-                if (!n)
-                        return r;
-                r++;
-        }
+static inline unsigned u64log2(uint64_t n) {
+
+        return (n > 1) ? __builtin_clzll(n) ^ 63U : 0;
 }
 
 static unsigned burst_modulate(unsigned burst, uint64_t available) {
-- 
1.8.1.4

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to