Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: inline msb



details:   https://anonhg.NetBSD.org/src/rev/7ef78cec4045
branches:  trunk
changeset: 1023089:7ef78cec4045
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Aug 23 06:26:37 2021 +0000

description:
lint: inline msb

This reduces the binary size on x86_64 by about 500 bytes.

No functional change.

diffstat:

 usr.bin/xlint/lint1/externs1.h |   3 +--
 usr.bin/xlint/lint1/lex.c      |  11 ++---------
 usr.bin/xlint/lint1/lint1.h    |   8 +++++++-
 3 files changed, 10 insertions(+), 12 deletions(-)

diffs (71 lines):

diff -r 362782a10d29 -r 7ef78cec4045 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h    Mon Aug 23 06:21:59 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h    Mon Aug 23 06:26:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: externs1.h,v 1.131 2021/08/23 06:21:59 rillig Exp $    */
+/*     $NetBSD: externs1.h,v 1.132 2021/08/23 06:26:37 rillig Exp $    */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -78,7 +78,6 @@
 extern FILE    *yyin;
 
 extern void    initscan(void);
-extern bool    msb(int64_t, tspec_t);
 extern int64_t convert_integer(int64_t, tspec_t, int);
 extern void    clear_warn_flags(void);
 extern sym_t   *getsym(sbuf_t *);
diff -r 362782a10d29 -r 7ef78cec4045 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Mon Aug 23 06:21:59 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Mon Aug 23 06:26:37 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.68 2021/08/23 06:21:59 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.69 2021/08/23 06:26:37 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.68 2021/08/23 06:21:59 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.69 2021/08/23 06:26:37 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -672,13 +672,6 @@
        return T_CON;
 }
 
-bool
-msb(int64_t q, tspec_t t)
-{
-
-       return (q & bit(size_in_bits(t) - 1)) != 0;
-}
-
 /*
  * Extend or truncate q to match t.  If t is signed, sign-extend.
  *
diff -r 362782a10d29 -r 7ef78cec4045 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Mon Aug 23 06:21:59 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Mon Aug 23 06:26:37 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.123 2021/08/22 21:27:15 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.124 2021/08/23 06:26:37 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -572,6 +572,12 @@
        return (uint64_t)1 << i;
 }
 
+static inline bool
+msb(int64_t q, tspec_t t)
+{
+       return (q & bit(size_in_bits(t) - 1)) != 0;
+}
+
 static inline uint64_t
 value_bits(unsigned bitsize)
 {



Home | Main Index | Thread Index | Old Index