mirror of
https://github.com/reactos/reactos.git
synced 2024-09-29 22:16:01 +00:00
[NTOS:KD] Simplify min-values calculations in KdpPrintToLogFile and KdpScreenPrint.
This commit is contained in:
parent
4585372c6d
commit
cee893be99
|
@ -174,10 +174,7 @@ KdpPrintToLogFile(PCHAR String,
|
||||||
OldIrql = KdbpAcquireLock(&KdpDebugLogSpinLock);
|
OldIrql = KdbpAcquireLock(&KdpDebugLogSpinLock);
|
||||||
|
|
||||||
beg = KdpCurrentPosition;
|
beg = KdpCurrentPosition;
|
||||||
num = KdpFreeBytes;
|
num = min(Length, KdpFreeBytes);
|
||||||
if (Length < num)
|
|
||||||
num = Length;
|
|
||||||
|
|
||||||
if (num != 0)
|
if (num != 0)
|
||||||
{
|
{
|
||||||
end = (beg + num) % KdpBufferSize;
|
end = (beg + num) % KdpBufferSize;
|
||||||
|
@ -475,11 +472,9 @@ KdpScreenPrint(PCHAR String,
|
||||||
/* Acquire the printing spinlock without waiting at raised IRQL */
|
/* Acquire the printing spinlock without waiting at raised IRQL */
|
||||||
OldIrql = KdbpAcquireLock(&KdpDmesgLogSpinLock);
|
OldIrql = KdbpAcquireLock(&KdpDmesgLogSpinLock);
|
||||||
|
|
||||||
/* Invariant: always_true(KdpDmesgFreeBytes == KdpDmesgBufferSize);
|
|
||||||
* set num to min(KdpDmesgFreeBytes, Length).
|
|
||||||
*/
|
|
||||||
num = (Length < KdpDmesgFreeBytes) ? Length : KdpDmesgFreeBytes;
|
|
||||||
beg = KdpDmesgCurrentPosition;
|
beg = KdpDmesgCurrentPosition;
|
||||||
|
/* Invariant: always_true(KdpDmesgFreeBytes == KdpDmesgBufferSize); */
|
||||||
|
num = min(Length, KdpDmesgFreeBytes);
|
||||||
if (num != 0)
|
if (num != 0)
|
||||||
{
|
{
|
||||||
end = (beg + num) % KdpDmesgBufferSize;
|
end = (beg + num) % KdpDmesgBufferSize;
|
||||||
|
|
Loading…
Reference in a new issue