ntdll: Avoid using Low/HighPart of a large integer when not necessary.

This commit is contained in:
Alexandre Julliard 2012-10-30 11:43:05 +01:00
parent 1fc362ce55
commit aacc450955
4 changed files with 13 additions and 21 deletions

View File

@ -756,9 +756,8 @@ static NTSTATUS CDROM_GetDriveGeometry(int dev, int fd, DISK_GEOMETRY* dg)
fsize = FRAME_OF_TOC(toc, toc.LastTrack+1)
- FRAME_OF_TOC(toc, 1); /* Total size in frames */
dg->Cylinders.u.LowPart = fsize / (64 * 32);
dg->Cylinders.u.HighPart = 0;
dg->Cylinders.QuadPart = fsize / (64 * 32);
dg->MediaType = RemovableMedia;
dg->TracksPerCylinder = 64;
dg->SectorsPerTrack = 32;
@ -2511,8 +2510,7 @@ static NTSTATUS DVD_ReadStructure(int dev, const DVD_READ_STRUCTURE *structure,
struct dvd_manufact manufact;
} s;
if (structure->BlockByteOffset.u.HighPart || structure->BlockByteOffset.u.LowPart)
FIXME(": BlockByteOffset is not handled\n");
if (structure->BlockByteOffset.QuadPart) FIXME(": BlockByteOffset is not handled\n");
switch (structure->Format)
{

View File

@ -2857,7 +2857,7 @@ NTSTATUS WINAPI NtCancelIoFileEx( HANDLE hFile, PIO_STATUS_BLOCK iosb, PIO_STATU
* of the queued APC, but not yet run. This is needed to ensure proper
* clean-up of allocated data.
*/
timeout.u.LowPart = timeout.u.HighPart = 0;
timeout.QuadPart = 0;
NtDelayExecution( TRUE, &timeout );
return io_status->u.Status;
}
@ -2889,7 +2889,7 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE hFile, PIO_STATUS_BLOCK io_status )
* of the queued APC, but not yet run. This is needed to ensure proper
* clean-up of allocated data.
*/
timeout.u.LowPart = timeout.u.HighPart = 0;
timeout.QuadPart = 0;
NtDelayExecution( TRUE, &timeout );
return io_status->u.Status;
}

View File

@ -223,8 +223,8 @@ static NTSTATUS TAPE_GetMediaParams( int fd, TAPE_GET_MEDIA_PARAMETERS *data )
if (status != STATUS_SUCCESS)
return status;
data->Capacity.u.LowPart = 1024 * 1024 * 1024;
data->Remaining.u.LowPart = 1024 * 1024 * 1024;
data->Capacity.QuadPart = 1024 * 1024 * 1024;
data->Remaining.QuadPart = 1024 * 1024 * 1024;
#ifdef HAVE_STRUCT_MTGET_MT_BLKSIZ
data->BlockSize = get.mt_blksiz;
#else

View File

@ -331,10 +331,9 @@ NTSTATUS WINAPI RtlSystemTimeToLocalTime( const LARGE_INTEGER *SystemTime,
*/
BOOLEAN WINAPI RtlTimeToSecondsSince1970( const LARGE_INTEGER *Time, LPDWORD Seconds )
{
ULONGLONG tmp = ((ULONGLONG)Time->u.HighPart << 32) | Time->u.LowPart;
tmp = tmp / TICKSPERSEC - SECS_1601_TO_1970;
ULONGLONG tmp = Time->QuadPart / TICKSPERSEC - SECS_1601_TO_1970;
if (tmp > 0xffffffff) return FALSE;
*Seconds = (DWORD)tmp;
*Seconds = tmp;
return TRUE;
}
@ -353,10 +352,9 @@ BOOLEAN WINAPI RtlTimeToSecondsSince1970( const LARGE_INTEGER *Time, LPDWORD Sec
*/
BOOLEAN WINAPI RtlTimeToSecondsSince1980( const LARGE_INTEGER *Time, LPDWORD Seconds )
{
ULONGLONG tmp = ((ULONGLONG)Time->u.HighPart << 32) | Time->u.LowPart;
tmp = tmp / TICKSPERSEC - SECS_1601_TO_1980;
ULONGLONG tmp = Time->QuadPart / TICKSPERSEC - SECS_1601_TO_1980;
if (tmp > 0xffffffff) return FALSE;
*Seconds = (DWORD)tmp;
*Seconds = tmp;
return TRUE;
}
@ -374,9 +372,7 @@ BOOLEAN WINAPI RtlTimeToSecondsSince1980( const LARGE_INTEGER *Time, LPDWORD Sec
*/
void WINAPI RtlSecondsSince1970ToTime( DWORD Seconds, LARGE_INTEGER *Time )
{
ULONGLONG secs = Seconds * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970;
Time->u.LowPart = (DWORD)secs;
Time->u.HighPart = (DWORD)(secs >> 32);
Time->QuadPart = Seconds * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970;
}
/******************************************************************************
@ -393,9 +389,7 @@ void WINAPI RtlSecondsSince1970ToTime( DWORD Seconds, LARGE_INTEGER *Time )
*/
void WINAPI RtlSecondsSince1980ToTime( DWORD Seconds, LARGE_INTEGER *Time )
{
ULONGLONG secs = Seconds * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1980;
Time->u.LowPart = (DWORD)secs;
Time->u.HighPart = (DWORD)(secs >> 32);
Time->QuadPart = Seconds * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1980;
}
/******************************************************************************