Use u64 here to avoid warnings, better precision.

The timeout value is u32 anyway, so an int was already a loss.
This commit is contained in:
Unknown W. Brackets
2012-11-22 16:40:26 -08:00
parent c2c2b77792
commit d3f2d9d10b
4 changed files with 17 additions and 17 deletions
+4 -4
View File
@@ -250,16 +250,16 @@ void ScheduleEvent(int cyclesIntoFuture, int event_type, u64 userdata)
}
// Returns cycles left in timer.
int UnscheduleEvent(int event_type, u64 userdata)
u64 UnscheduleEvent(int event_type, u64 userdata)
{
int result = 0;
u64 result = 0;
if (!first)
return result;
while(first)
{
if (first->type == event_type && first->userdata == userdata)
{
result = (int)(first->time - globalTimer);
result = first->time - globalTimer;
Event *next = first->next;
FreeEvent(first);
@@ -278,7 +278,7 @@ int UnscheduleEvent(int event_type, u64 userdata)
{
if (ptr->type == event_type && ptr->userdata == userdata)
{
result = (int)(ptr->time - globalTimer);
result = ptr->time - globalTimer;
prev->next = ptr->next;
FreeEvent(ptr);
+1 -1
View File
@@ -81,7 +81,7 @@ namespace CoreTiming
void ScheduleEvent(int cyclesIntoFuture, int event_type, u64 userdata=0);
void ScheduleEvent_Threadsafe(int cyclesIntoFuture, int event_type, u64 userdata=0);
void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata=0);
int UnscheduleEvent(int event_type, u64 userdata);
u64 UnscheduleEvent(int event_type, u64 userdata);
void RemoveEvent(int event_type);
void RemoveThreadsafeEvent(int event_type);
+8 -8
View File
@@ -223,8 +223,8 @@ void sceKernelDeleteMutex(SceUID id)
if (timeoutPtr != 0 && mutexWaitTimer != 0)
{
// Remove any event for this thread.
int cyclesLeft = CoreTiming::UnscheduleEvent(mutexWaitTimer, threadID);
Memory::Write_U32(cyclesToUs(cyclesLeft), timeoutPtr);
u64 cyclesLeft = CoreTiming::UnscheduleEvent(mutexWaitTimer, threadID);
Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr);
}
__KernelResumeThreadFromWait(threadID, SCE_KERNEL_ERROR_WAIT_DELETE);
@@ -300,8 +300,8 @@ bool __KernelUnlockMutex(Mutex *mutex, u32 &error)
if (timeoutPtr != 0 && mutexWaitTimer != 0)
{
// Remove any event for this thread.
int cyclesLeft = CoreTiming::UnscheduleEvent(mutexWaitTimer, threadID);
Memory::Write_U32(cyclesToUs(cyclesLeft), timeoutPtr);
u64 cyclesLeft = CoreTiming::UnscheduleEvent(mutexWaitTimer, threadID);
Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr);
}
__KernelResumeThreadFromWait(threadID, 0);
@@ -554,8 +554,8 @@ void sceKernelDeleteLwMutex(u32 workareaPtr)
if (timeoutPtr != 0 && lwMutexWaitTimer != 0)
{
// Remove any event for this thread.
int cyclesLeft = CoreTiming::UnscheduleEvent(lwMutexWaitTimer, threadID);
Memory::Write_U32(cyclesToUs(cyclesLeft), timeoutPtr);
u64 cyclesLeft = CoreTiming::UnscheduleEvent(lwMutexWaitTimer, threadID);
Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr);
}
__KernelResumeThreadFromWait(threadID, SCE_KERNEL_ERROR_WAIT_DELETE);
@@ -648,8 +648,8 @@ bool __KernelUnlockLwMutex(NativeLwMutexWorkarea &workarea, u32 &error)
if (timeoutPtr != 0 && lwMutexWaitTimer != 0)
{
// Remove any event for this thread.
int cyclesLeft = CoreTiming::UnscheduleEvent(lwMutexWaitTimer, threadID);
Memory::Write_U32(cyclesToUs(cyclesLeft), timeoutPtr);
u64 cyclesLeft = CoreTiming::UnscheduleEvent(lwMutexWaitTimer, threadID);
Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr);
}
__KernelResumeThreadFromWait(threadID, 0);
+4 -4
View File
@@ -87,8 +87,8 @@ bool __KernelClearSemaThreads(Semaphore *s, int reason)
if (timeoutPtr != 0 && semaWaitTimer != 0)
{
// Remove any event for this thread.
int cyclesLeft = CoreTiming::UnscheduleEvent(semaWaitTimer, threadID);
Memory::Write_U32(cyclesToUs(cyclesLeft), timeoutPtr);
u64 cyclesLeft = CoreTiming::UnscheduleEvent(semaWaitTimer, threadID);
Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr);
}
__KernelResumeThreadFromWait(threadID, reason);
@@ -257,8 +257,8 @@ retry:
if (timeoutPtr != 0 && semaWaitTimer != 0)
{
// Remove any event for this thread.
int cyclesLeft = CoreTiming::UnscheduleEvent(semaWaitTimer, threadID);
Memory::Write_U32(cyclesToUs(cyclesLeft), timeoutPtr);
u64 cyclesLeft = CoreTiming::UnscheduleEvent(semaWaitTimer, threadID);
Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr);
}
__KernelResumeThreadFromWait(threadID, 0);