]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add cast_to_pointer to cast an integer to void * pointer
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 21 May 2021 22:58:36 +0000 (15:58 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 22 May 2021 12:09:15 +0000 (05:09 -0700)
include/libc-pointer-arith.h

index 72e722c5aae773fd4d5d9435785afb768ba0bf27..04ba5376177b4ec83a401a84c710731e92d6c34b 100644 (file)
@@ -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}.  */