Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Created July 19, 2011 14:41
Show Gist options
  • Save piscisaureus/1092583 to your computer and use it in GitHub Desktop.
Save piscisaureus/1092583 to your computer and use it in GitHub Desktop.
void __declspec(noinline) uv_update_time() {
00C44170 push esi
DWORD ticks = GetTickCount();
00C44171 call dword ptr [__imp__GetTickCount@0 (0C57078h)]
if (ticks < (LOOP->time & 0xffffffff)) {
00C44177 mov esi,dword ptr [_uv_main_loop_+8 (0C62048h)]
00C4417D xor edx,edx
00C4417F xor ecx,ecx
00C44181 cmp edx,ecx
00C44183 jg uv_update_time+3Ah (0C441AAh)
00C44185 jl uv_update_time+1Bh (0C4418Bh)
00C44187 cmp eax,esi
00C44189 jae uv_update_time+3Ah (0C441AAh)
/* GetTickCount has wrapped */
LOOP->time += (int64_t) DWORD_MAX + 1;
00C4418B add esi,ecx
00C4418D mov ecx,dword ptr [_uv_main_loop_+0Ch (0C6204Ch)]
00C44193 adc ecx,1
}
/* Set the low-order dword of the time */
LOOP->time = (int64_t) (LOOP->time & ~(int64_t) DWORD_MAX) | ticks;
00C44196 xor esi,esi
00C44198 or esi,eax
00C4419A or ecx,edx
00C4419C mov dword ptr [_uv_main_loop_+8 (0C62048h)],esi
00C441A2 mov dword ptr [_uv_main_loop_+0Ch (0C6204Ch)],ecx
00C441A8 pop esi
}
00C441A9 ret
/* GetTickCount has wrapped */
LOOP->time += (int64_t) DWORD_MAX + 1;
00C441AA mov ecx,dword ptr [_uv_main_loop_+0Ch (0C6204Ch)]
}
/* Set the low-order dword of the time */
LOOP->time = (int64_t) (LOOP->time & ~(int64_t) DWORD_MAX) | ticks;
00C441B0 xor esi,esi
00C441B2 or esi,eax
00C441B4 or ecx,edx
00C441B6 mov dword ptr [_uv_main_loop_+8 (0C62048h)],esi
00C441BC mov dword ptr [_uv_main_loop_+0Ch (0C6204Ch)],ecx
00C441C2 pop esi
}
00C441C3 ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment