I am going to post another answer because there is something to add.
unsigned *p = *(unsigned**)(((unsigned long)&i) & ~8191);
leads to the fact that p is a pointer to the beginning of a memory block of size 8192 bytes. However, the code is incorrect. If p exceeds INT_MAX (whatever it may be or it will be distinguished without an unsigned sign, and not an unsigned long sign), the high bits are trimmed with a mask. The correct code is as follows:
unsigned *p = *(unsigned**)(((ptrdiff_t)&i) & ~(ptrdiff_t)8191);
or using uintptr_t:
unsigned *p = *(unsigned**)(((uintptr_t)&i) & ~(uintptr_t)8191U);
It is necessary to send an integer and return to the pointer for the code to work; however, to ensure that the int-size pointer requires the use of ptrdiff_t (recall that signed and unsigned behave the same for bitwise operations). As for why they don't write them with hexadecimal constants, who cares. The guys who do this know their abilities 2 by heart. Faster reading 8191, then 0x1FFF.
Joshua Oct 23 '15 at 19:43 2015-10-23 19:43
source share