Module Name:    src
Committed By:   rillig
Date:           Mon Aug 23 06:26:37 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: externs1.h lex.c lint1.h

Log Message:
lint: inline msb

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

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/xlint/lint1/lint1.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.131 src/usr.bin/xlint/lint1/externs1.h:1.132
--- src/usr.bin/xlint/lint1/externs1.h:1.131	Mon Aug 23 06:21:59 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Mon Aug 23 06:26:37 2021
@@ -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	symt_t	symtyp;
 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 *);

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.68 src/usr.bin/xlint/lint1/lex.c:1.69
--- src/usr.bin/xlint/lint1/lex.c:1.68	Mon Aug 23 06:21:59 2021
+++ src/usr.bin/xlint/lint1/lex.c	Mon Aug 23 06:26:37 2021
@@ -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 @@ lex_integer_constant(const char *yytext,
 	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.
  *

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.123 src/usr.bin/xlint/lint1/lint1.h:1.124
--- src/usr.bin/xlint/lint1/lint1.h:1.123	Sun Aug 22 21:27:15 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Mon Aug 23 06:26:37 2021
@@ -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 @@ bit(unsigned i)
 	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)
 {

Reply via email to