From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 00E77383B409 for ; Sat, 22 May 2021 03:50:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 00E77383B409 Received: by mail-pf1-x432.google.com with SMTP id f22so7979097pfn.0 for ; Fri, 21 May 2021 20:50:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dzXduyOwyTQjuxYgKTKVJs7yl12T91kKlB+VoAWZa8s=; b=f9JeKtS3PQrEzIf5u5Zw0U2ssAeub8p4MHGiJN8ufnwF31/KfHD4q2y8aTKWEVAP2Z gmhCU4kAVsfos8nmTOxyD2mjlY+xAMrk2C9zlkOTey2eFVUEqx9dG0NwMJb8g7id04as SZJNGb6NmTQw++GCH0fq+CxgW6/YgkaTXoJm+kDG+acrMDWr6tiHiYgBuCZq1V1fcsIx xXdzionHKA5m9sZaQV5aWifrIgZeODT6X39Js4Z6m81vhHRsf3RYe0nAWqha10dZAxiN fSr+Nu3EqJ4wYgOYfamZUM04ezmZUvCZsFy0a77SP8Pi4YapsX2rfV3BNfCC5KwPH4K0 EP/A== X-Gm-Message-State: AOAM531CLVSXW/rDAgEsEPuomhxBxjmiLrLJf8aNyWU23E/1qIjcYDzr SfsmHwyXX2+uxZslJoJuDw2hh3TcYebAPw== X-Google-Smtp-Source: ABdhPJw2bw0Gat9KVb9G6kdVbDi/b3Sm0hVIRzED2Qet8PhoTN7JgijhHAd7DsOwA/KqdzPG51dzfg== X-Received: by 2002:a63:ee10:: with SMTP id e16mr2047197pgi.135.1621655421133; Fri, 21 May 2021 20:50:21 -0700 (PDT) Received: from gnu-cfl-2.localdomain ([172.56.38.102]) by smtp.gmail.com with ESMTPSA id w124sm5377961pfb.73.2021.05.21.20.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 20:50:19 -0700 (PDT) Received: from gnu-cfl-2.. (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id 3CC57C0387; Fri, 21 May 2021 20:50:18 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: Florian Weimer , Noah Goldstein Subject: [PATCH v6 1/5] Add cast_to_pointer to cast an integer to void * pointer Date: Fri, 21 May 2021 20:50:14 -0700 Message-Id: <20210522035018.2652112-2-hjl.tools@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210522035018.2652112-1-hjl.tools@gmail.com> References: <20210522035018.2652112-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3034.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 03:50:23 -0000 --- include/libc-pointer-arith.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/libc-pointer-arith.h b/include/libc-pointer-arith.h index 72e722c5aa..04ba537617 100644 --- a/include/libc-pointer-arith.h +++ b/include/libc-pointer-arith.h @@ -37,6 +37,9 @@ /* Cast an integer or a pointer VAL to integer with proper type. */ # define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val)) +/* Cast an integer VAL to void * pointer. */ +# define cast_to_pointer(val) ((void *) (uintptr_t) (val)) + /* Align a value by rounding down to closest size. e.g. Using size of 4096, we get this behavior: {4095, 4096, 4097} = {0, 4096, 4096}. */ -- 2.31.1