From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1388 invoked from network); 26 May 2023 09:40:37 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 26 May 2023 09:40:37 -0000 Received: (qmail 3655 invoked by uid 550); 26 May 2023 09:40:35 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 3623 invoked from network); 26 May 2023 09:40:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ydoUR3h0SIWDfmrVpvAREB853/AjM1faDn0TZ8yMWDU=; b=Wnu4VxaQ1Ih1SXCzUPBKSK1zUCYApXih7eyJNGDC+hXnp9VXKH2QZxRU pzSTlKoymYp6Bbpwlv1n2sfIg9ll08Zz/AkpsdDGXcgJyEPlO7N1JuL6+ 5Q38WYsnO9hloRDgjTCcfBurexoYSjQI0QKI6H9Rr2twyC325ZW6oRoVD Y=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Jens.Gustedt@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.00,193,1681164000"; d="scan'208";a="109851800" From: Jens Gustedt To: musl@lists.openwall.com Date: Fri, 26 May 2023 11:40:01 +0200 Message-Id: <79def28bf17f50810811da4fb0cfa0e2bd2af5bd.1684933006.git.Jens.Gustedt@inria.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [C23 stdckdint.h 1/1] C23: add the stdckdint.h header for checked integer operations These macros have a direct correspondence with gcc builtins, so the implementation for musl is trivial. Note that this only intefaces the type-generic features, so no function symbol is added to the library. Since also this is a new header that only exposes its contents when it is explicitly included, no feature test macros are needed. --- include/stdckdint.h | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 include/stdckdint.h diff --git a/include/stdckdint.h b/include/stdckdint.h new file mode 100644 index 00000000..893126dc --- /dev/null +++ b/include/stdckdint.h @@ -0,0 +1,8 @@ +#ifndef __STDC_VERSION_STDCKDINT_H__ +#define __STDC_VERSION_STDCKDINT_H__ 202311L + +#define ckd_add(R, A, B) __builtin_add_overflow ((A), (B), (R)) +#define ckd_sub(R, A, B) __builtin_sub_overflow ((A), (B), (R)) +#define ckd_mul(R, A, B) __builtin_mul_overflow ((A), (B), (R)) + +#endif -- 2.34.1