about summary refs log tree commit diff
path: root/include/libc-pointer-arith.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-05-21 15:58:36 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-05-22 05:09:15 -0700
commit94bc766ec627b2c44a6c72bc40013957ffc4b6cd (patch)
treeba4b66b4c82a23b7f67c665b5cd450bf5eb333da /include/libc-pointer-arith.h
parent49e182c7376b0fa30c18d0b7003a8e84624494c0 (diff)
downloadglibc-94bc766ec627b2c44a6c72bc40013957ffc4b6cd.tar.gz
glibc-94bc766ec627b2c44a6c72bc40013957ffc4b6cd.tar.xz
glibc-94bc766ec627b2c44a6c72bc40013957ffc4b6cd.zip
Add cast_to_pointer to cast an integer to void * pointer
Diffstat (limited to 'include/libc-pointer-arith.h')
-rw-r--r--include/libc-pointer-arith.h3
1 files changed, 3 insertions, 0 deletions
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}.  */