Copy link
@gvanem

gvanem Sep 15, 2017

Contributor

@infrastation I have an Intel-i7 CPU. Seems MSVC uses SSE2 for that macro.

double me_to_double (uint8_t vtime)
{
  return ME_TO_DOUBLE (vtime);
}

Disassembles into:

 _me_to_double:
         sub             esp,0x00000008
         mov             dl,byte ptr 0xc[esp]
         mov             eax,0x00000001
         movzx           ecx,dl
         and             ecx,0x0000000f
         shl             eax,cl
         shr             dl,0x04
         movd            xmm2,eax
         movzx           eax,dl
         cvtdq2pd        xmm2,xmm2
         movd            xmm1,eax
         cvtdq2pd        xmm1,xmm1
         mulsd           xmm1,__real@3fb0000000000000
         addsd           xmm1,__real@3ff0000000000000
         mulsd           xmm1,__real@3fb0000000000000
         mulsd           xmm2,xmm1
         movsd           [esp],xmm2
         fld             qword ptr [esp]
         add             esp,0x00000008
         ret

I get the same 1 msec "error" when using -arch:IA32 (no SSE instructions). No surprise there.