Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gen lint is not smart enough to figure out that ilo...



details:   https://anonhg.NetBSD.org/src/rev/8dc93d2638e6
branches:  trunk
changeset: 454645:8dc93d2638e6
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Sep 23 18:17:03 2019 +0000

description:
lint is not smart enough to figure out that ilog2() is constant.

diffstat:

 lib/libc/gen/arc4random.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 3448a6dc091a -r 8dc93d2638e6 lib/libc/gen/arc4random.c
--- a/lib/libc/gen/arc4random.c Mon Sep 23 18:01:09 2019 +0000
+++ b/lib/libc/gen/arc4random.c Mon Sep 23 18:17:03 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arc4random.c,v 1.31 2016/03/25 22:13:23 riastradh Exp $        */
+/*     $NetBSD: arc4random.c,v 1.32 2019/09/23 18:17:03 christos Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: arc4random.c,v 1.31 2016/03/25 22:13:23 riastradh Exp $");
+__RCSID("$NetBSD: arc4random.c,v 1.32 2019/09/23 18:17:03 christos Exp $");
 
 #include "namespace.h"
 #include "reentrant.h"
@@ -355,9 +355,10 @@
         *      log_2 (o 2^(8 i)) = log_2 o + log_2 2^(8 i)
         *        = log_2 o + 8 i.
         */
-       __CTASSERT(CHAR_BIT * sizeof n <=
-           (/*LINTED*/ilog2(crypto_core_OUTPUTBYTES) +
-               8*crypto_core_INPUTBYTES));
+#ifndef __lint__
+       __CTASSERT(CHAR_BIT * sizeof n <= (ilog2(crypto_core_OUTPUTBYTES) +
+               8 * crypto_core_INPUTBYTES));
+#endif
 
        p8 = buf;
        p32 = (uint8_t *)roundup2((uintptr_t)p8, 4);



Home | Main Index | Thread Index | Old Index