Skip to content

Commit f859257

Browse files
committed
Improve macro usage
1 parent 7518171 commit f859257

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

phlib/filepool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ VOID PhFppFreeBlocks(
12771277
RtlInitializeBitMap(&bitmap, SegmentHeader->Bitmap, PH_FP_BLOCK_COUNT);
12781278

12791279
// Mark the blocks as free.
1280-
startIndex = (ULONG)((PCHAR)BlockHeader - (PCHAR)FirstBlock) >> Pool->BlockShift;
1280+
startIndex = PtrToUlong(PTR_SUB_OFFSET(BlockHeader, FirstBlock)) >> Pool->BlockShift;
12811281
blockSpan = BlockHeader->Span;
12821282
RtlClearBits(&bitmap, startIndex, blockSpan);
12831283
SegmentHeader->FreeBlocks += blockSpan;
@@ -1480,7 +1480,7 @@ ULONG PhFppEncodeRva(
14801480
_In_ PVOID Address
14811481
)
14821482
{
1483-
return (SegmentIndex << Pool->SegmentShift) + (ULONG)((PCHAR)Address - (PCHAR)FirstBlock);
1483+
return (SegmentIndex << Pool->SegmentShift) + PtrToUlong(PTR_SUB_OFFSET(Address, FirstBlock));
14841484
}
14851485

14861486
/**

0 commit comments

Comments
 (0)