From owner-svn-src-stable-10@freebsd.org Sat Feb 4 16:09:08 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54876CD0132; Sat, 4 Feb 2017 16:09:08 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23BF47B5; Sat, 4 Feb 2017 16:09:08 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v14G97kp058211; Sat, 4 Feb 2017 16:09:07 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v14G97eC058210; Sat, 4 Feb 2017 16:09:07 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702041609.v14G97eC058210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 4 Feb 2017 16:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313215 - stable/10/lib/libnetbsd/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2017 16:09:08 -0000 Author: ngie Date: Sat Feb 4 16:09:07 2017 New Revision: 313215 URL: https://svnweb.freebsd.org/changeset/base/313215 Log: MFC r311972: Add __BIT and __BITS macros from NetBSD to help support new testcases Modified: stable/10/lib/libnetbsd/sys/cdefs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libnetbsd/sys/cdefs.h ============================================================================== --- stable/10/lib/libnetbsd/sys/cdefs.h Sat Feb 4 16:02:49 2017 (r313214) +++ stable/10/lib/libnetbsd/sys/cdefs.h Sat Feb 4 16:09:07 2017 (r313215) @@ -69,4 +69,13 @@ */ #define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) +/* __BIT(n): nth bit, where __BIT(0) == 0x1. */ +#define __BIT(__n) \ + (((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : \ + ((uintmax_t)1 << (uintmax_t)((__n) & (NBBY * sizeof(uintmax_t) - 1)))) + +/* __BITS(m, n): bits m through n, m < n. */ +#define __BITS(__m, __n) \ + ((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1)) + #endif /* _LIBNETBSD_SYS_CDEFS_H_ */