Here's what it does on 32-bit Windows. The commented line is where the difference is.
mov ECX,8[ESP]
mov EAX,4[ESP]
test ECX,ECX
jl Lsecond
jg Lfirst
test EAX,EAX
jb Lsecond
Lfirst: mov EAX,0xFFFFFFFF
mov ECX,EAX // xor ECX, ECX on failing case
Lsecond: mov EDX,ECX
ret 8