This question already has an answer here:
I've opened a 64 bit DLL file in IDA. One function has this pseudocode:
unsigned __int64 output;
ULONG input;
output = (unsigned __int64)(input * (unsigned __int128)0xE38E38E38E38E38Fui64 >> 64) >> 5;
Here is the equivalent assembly view:
mov rcx, r13
mov [rsp+56], rcx
mov edx, [rsp+152]
mov rax, 0E38E38E38E38E38Fh
mul rdx
mov r8, rdx
shr r8, 5
mov [r15], r8d
cmp r8d, esi
cmova r8d, ebx
When I want to compile that same code in MSVC++, it shows:
warning C4293: '>>': shift count negative or too big, undefined behavior
My question is, what does that long constant value do? Is there anything cryptic with that bit shifting?