From nobody Thu Feb 26 07:41:52 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fM3Ls6218z6SwH8 for ; Thu, 26 Feb 2026 07:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fM3Ls5JZ8z3lWg for ; Thu, 26 Feb 2026 07:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772091717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wxAXAv/8VCCTYZvVAx0AfwA4gzW/aCQLMc/yFdbPBcM=; b=xY6LGi0JJc4iW9DpFpozZ4FbcdQH5qTeqJzpWaP6rRm9NAaqFFmK2fixl1iVCOQYwm+9Km Y1UJ6d9znXxmG5IoMcEvIzowvMXmEZpEEbLDNKF4JEruNrVV25q+tJQcu11LWDnOaqxlY3 keDKsj5DHdBzJkZfyXliDBHtorGAxuCGnWF8cUh6/ckB+sjchkBMuq4aUYGaC6hq57O5xa eN/nozb1i84hzsFHyuIfipYHDslmV+ab/vQMo03hZWAuUyyRziJPbXLUmdYHZ2aVKTZobO J+QdRhKS5OdSOZRvJ5X3snOnDNMqp83uT49qR4sZH7/z7CcqfE4iRmHCD4xcqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772091717; a=rsa-sha256; cv=none; b=ikxdDDBcSG5KtEh+4hGM78lcT2Sj4ILqdrz5kaO5IdbMIAdcVBr06irvV4p0+IduJCqqyX ycvHBWJo5b+BmPlNWc9fWcolBn/s6YBOQwaEdYcvlnMpWvkJK90BgaU8SxOdaCPLpxCFme rYU4+r9L2N2o1rcBBrFS6B/l76phcKEmDpX72IUu7F81pdWgELjl1MYzGgEapo5cqoycsf PtZXBhAftM2IPAglpxMTTsuI5qDhBlM3sw+FxiEudsGIRwJqRXCYPgx+w1xq+GvAsozwNs UfIkXQGfzgLXk6bpnANK6xfhg4mwQyY6Qt957PwxqqEbbaF4Ica7NbKFlRHJfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772091717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wxAXAv/8VCCTYZvVAx0AfwA4gzW/aCQLMc/yFdbPBcM=; b=cYDP6R2EL9vIOvrDbvwXOq5h8VSJLHE4XQrtM88Vk7vRJED+KwKLzwJ4OprxyK0p5oDS/p KKGq0pY2yCec//N08JrXORka4llwY90uHeSwrJ3R4Ym0IU/HME2bZOBAy/iOLFmmmJs2QJ nAqhVVfxnDr/SQ/b6r7w/o1VTSD0wwmCcb+TZB234miVAa842/3Pluj0gHeNrUD2KSD/Ju j4w2FiuxaJPnQ5ioe7domaG+g8YRsPT5Kb6N1eFy3QsTqV3eX32Z5t2hVvgwfQUYkjz5Eh xSE5B/VlIzRcLYtveJMIjxPUnNrkfD7aloUryulqj0WUb01MsBd1TI2o6mSATw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fM3Ls4sHsz79h for ; Thu, 26 Feb 2026 07:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19c99 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 26 Feb 2026 07:41:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Enji Cooper Subject: git: db5344a7445f - main - lib/libnetbsd: bring in `__type_m{ax,in}*` macro family List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ngie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db5344a7445f1a796bc3cacd32a46e88e3e589a7 Auto-Submitted: auto-generated Date: Thu, 26 Feb 2026 07:41:52 +0000 Message-Id: <699ff940.19c99.1af2c339@gitrepo.freebsd.org> The branch main has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=db5344a7445f1a796bc3cacd32a46e88e3e589a7 commit db5344a7445f1a796bc3cacd32a46e88e3e589a7 Author: Enji Cooper AuthorDate: 2026-02-26 02:29:49 +0000 Commit: Enji Cooper CommitDate: 2026-02-26 07:41:08 +0000 lib/libnetbsd: bring in `__type_m{ax,in}*` macro family These macros are used by some of the NetBSD tests which calculate the size of types, e.g., `__type_max(time_t)`. This wraps up the set of macros needed in order to update to the a netbsd-tests snapshot from this past month. Obtained from: https://github.com/netbsd/src (55b4b44) MFC after: 1 week --- lib/libnetbsd/sys/cdefs.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/libnetbsd/sys/cdefs.h b/lib/libnetbsd/sys/cdefs.h index 78c80735ad01..e4ff4a516519 100644 --- a/lib/libnetbsd/sys/cdefs.h +++ b/lib/libnetbsd/sys/cdefs.h @@ -110,4 +110,34 @@ */ #define __nothing (/*LINTED*/(void)0) +#define __negative_p(x) (!((x) > 0) && ((x) != 0)) + +#define __type_min_s(t) ((t)((1ULL << (sizeof(t) * __CHAR_BIT__ - 1)))) +#define __type_max_s(t) ((t)~((1ULL << (sizeof(t) * __CHAR_BIT__ - 1)))) +#define __type_min_u(t) ((t)0ULL) +#define __type_max_u(t) ((t)~0ULL) +#define __type_is_signed(t) (/*LINTED*/__type_min_s(t) + (t)1 < (t)1) +#define __type_min(t) (__type_is_signed(t) ? __type_min_s(t) : __type_min_u(t)) +#define __type_max(t) (__type_is_signed(t) ? __type_max_s(t) : __type_max_u(t)) + + +#define __type_fit_u(t, a) \ + (/*LINTED*/!__negative_p(a) && \ + ((__UINTMAX_TYPE__)((a) + __zeroull()) <= \ + (__UINTMAX_TYPE__)__type_max_u(t))) + +#define __type_fit_s(t, a) \ + (/*LINTED*/__negative_p(a) \ + ? ((__INTMAX_TYPE__)((a) + __zeroll()) >= \ + (__INTMAX_TYPE__)__type_min_s(t)) \ + : ((__INTMAX_TYPE__)((a) + __zeroll()) >= (__INTMAX_TYPE__)0 && \ + ((__INTMAX_TYPE__)((a) + __zeroll()) <= \ + (__INTMAX_TYPE__)__type_max_s(t)))) + +/* + * return true if value 'a' fits in type 't' + */ +#define __type_fit(t, a) (__type_is_signed(t) ? \ + __type_fit_s(t, a) : __type_fit_u(t, a)) + #endif /* _LIBNETBSD_SYS_CDEFS_H_ */