ntdll: Avoid using Low/HighPart of a large integer when not necessary.
This commit is contained in:
parent
1fc362ce55
commit
aacc450955
|
@ -756,9 +756,8 @@ static NTSTATUS CDROM_GetDriveGeometry(int dev, int fd, DISK_GEOMETRY* dg)
|
||||||
|
|
||||||
fsize = FRAME_OF_TOC(toc, toc.LastTrack+1)
|
fsize = FRAME_OF_TOC(toc, toc.LastTrack+1)
|
||||||
- FRAME_OF_TOC(toc, 1); /* Total size in frames */
|
- FRAME_OF_TOC(toc, 1); /* Total size in frames */
|
||||||
|
|
||||||
dg->Cylinders.u.LowPart = fsize / (64 * 32);
|
dg->Cylinders.QuadPart = fsize / (64 * 32);
|
||||||
dg->Cylinders.u.HighPart = 0;
|
|
||||||
dg->MediaType = RemovableMedia;
|
dg->MediaType = RemovableMedia;
|
||||||
dg->TracksPerCylinder = 64;
|
dg->TracksPerCylinder = 64;
|
||||||
dg->SectorsPerTrack = 32;
|
dg->SectorsPerTrack = 32;
|
||||||
|
@ -2511,8 +2510,7 @@ static NTSTATUS DVD_ReadStructure(int dev, const DVD_READ_STRUCTURE *structure,
|
||||||
struct dvd_manufact manufact;
|
struct dvd_manufact manufact;
|
||||||
} s;
|
} s;
|
||||||
|
|
||||||
if (structure->BlockByteOffset.u.HighPart || structure->BlockByteOffset.u.LowPart)
|
if (structure->BlockByteOffset.QuadPart) FIXME(": BlockByteOffset is not handled\n");
|
||||||
FIXME(": BlockByteOffset is not handled\n");
|
|
||||||
|
|
||||||
switch (structure->Format)
|
switch (structure->Format)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
* of the queued APC, but not yet run. This is needed to ensure proper
|
||||||
* clean-up of allocated data.
|
* clean-up of allocated data.
|
||||||
*/
|
*/
|
||||||
timeout.u.LowPart = timeout.u.HighPart = 0;
|
timeout.QuadPart = 0;
|
||||||
NtDelayExecution( TRUE, &timeout );
|
NtDelayExecution( TRUE, &timeout );
|
||||||
return io_status->u.Status;
|
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
|
* of the queued APC, but not yet run. This is needed to ensure proper
|
||||||
* clean-up of allocated data.
|
* clean-up of allocated data.
|
||||||
*/
|
*/
|
||||||
timeout.u.LowPart = timeout.u.HighPart = 0;
|
timeout.QuadPart = 0;
|
||||||
NtDelayExecution( TRUE, &timeout );
|
NtDelayExecution( TRUE, &timeout );
|
||||||
return io_status->u.Status;
|
return io_status->u.Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,8 +223,8 @@ static NTSTATUS TAPE_GetMediaParams( int fd, TAPE_GET_MEDIA_PARAMETERS *data )
|
||||||
if (status != STATUS_SUCCESS)
|
if (status != STATUS_SUCCESS)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
data->Capacity.u.LowPart = 1024 * 1024 * 1024;
|
data->Capacity.QuadPart = 1024 * 1024 * 1024;
|
||||||
data->Remaining.u.LowPart = 1024 * 1024 * 1024;
|
data->Remaining.QuadPart = 1024 * 1024 * 1024;
|
||||||
#ifdef HAVE_STRUCT_MTGET_MT_BLKSIZ
|
#ifdef HAVE_STRUCT_MTGET_MT_BLKSIZ
|
||||||
data->BlockSize = get.mt_blksiz;
|
data->BlockSize = get.mt_blksiz;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -331,10 +331,9 @@ NTSTATUS WINAPI RtlSystemTimeToLocalTime( const LARGE_INTEGER *SystemTime,
|
||||||
*/
|
*/
|
||||||
BOOLEAN WINAPI RtlTimeToSecondsSince1970( const LARGE_INTEGER *Time, LPDWORD Seconds )
|
BOOLEAN WINAPI RtlTimeToSecondsSince1970( const LARGE_INTEGER *Time, LPDWORD Seconds )
|
||||||
{
|
{
|
||||||
ULONGLONG tmp = ((ULONGLONG)Time->u.HighPart << 32) | Time->u.LowPart;
|
ULONGLONG tmp = Time->QuadPart / TICKSPERSEC - SECS_1601_TO_1970;
|
||||||
tmp = tmp / TICKSPERSEC - SECS_1601_TO_1970;
|
|
||||||
if (tmp > 0xffffffff) return FALSE;
|
if (tmp > 0xffffffff) return FALSE;
|
||||||
*Seconds = (DWORD)tmp;
|
*Seconds = tmp;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,10 +352,9 @@ BOOLEAN WINAPI RtlTimeToSecondsSince1970( const LARGE_INTEGER *Time, LPDWORD Sec
|
||||||
*/
|
*/
|
||||||
BOOLEAN WINAPI RtlTimeToSecondsSince1980( const LARGE_INTEGER *Time, LPDWORD Seconds )
|
BOOLEAN WINAPI RtlTimeToSecondsSince1980( const LARGE_INTEGER *Time, LPDWORD Seconds )
|
||||||
{
|
{
|
||||||
ULONGLONG tmp = ((ULONGLONG)Time->u.HighPart << 32) | Time->u.LowPart;
|
ULONGLONG tmp = Time->QuadPart / TICKSPERSEC - SECS_1601_TO_1980;
|
||||||
tmp = tmp / TICKSPERSEC - SECS_1601_TO_1980;
|
|
||||||
if (tmp > 0xffffffff) return FALSE;
|
if (tmp > 0xffffffff) return FALSE;
|
||||||
*Seconds = (DWORD)tmp;
|
*Seconds = tmp;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,9 +372,7 @@ BOOLEAN WINAPI RtlTimeToSecondsSince1980( const LARGE_INTEGER *Time, LPDWORD Sec
|
||||||
*/
|
*/
|
||||||
void WINAPI RtlSecondsSince1970ToTime( DWORD Seconds, LARGE_INTEGER *Time )
|
void WINAPI RtlSecondsSince1970ToTime( DWORD Seconds, LARGE_INTEGER *Time )
|
||||||
{
|
{
|
||||||
ULONGLONG secs = Seconds * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970;
|
Time->QuadPart = Seconds * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970;
|
||||||
Time->u.LowPart = (DWORD)secs;
|
|
||||||
Time->u.HighPart = (DWORD)(secs >> 32);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -393,9 +389,7 @@ void WINAPI RtlSecondsSince1970ToTime( DWORD Seconds, LARGE_INTEGER *Time )
|
||||||
*/
|
*/
|
||||||
void WINAPI RtlSecondsSince1980ToTime( DWORD Seconds, LARGE_INTEGER *Time )
|
void WINAPI RtlSecondsSince1980ToTime( DWORD Seconds, LARGE_INTEGER *Time )
|
||||||
{
|
{
|
||||||
ULONGLONG secs = Seconds * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1980;
|
Time->QuadPart = Seconds * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1980;
|
||||||
Time->u.LowPart = (DWORD)secs;
|
|
||||||
Time->u.HighPart = (DWORD)(secs >> 32);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue