From: H.J. Lu Date: Fri, 21 May 2021 22:58:36 +0000 (-0700) Subject: Add cast_to_pointer to cast an integer to void * pointer X-Git-Tag: glibc-2.34~366 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94bc766ec627b2c44a6c72bc40013957ffc4b6cd;p=thirdparty%2Fglibc.git Add cast_to_pointer to cast an integer to void * pointer --- diff --git a/include/libc-pointer-arith.h b/include/libc-pointer-arith.h index 72e722c5aae..04ba5376177 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}. */