From 3616632f86be082738bbe64c19f648f8fddb7551 Mon Sep 17 00:00:00 2001 From: dmex Date: Tue, 15 Mar 2022 16:00:58 +1100 Subject: [PATCH] Add PhCountBitsUlongPtr --- phlib/include/phsup.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/phlib/include/phsup.h b/phlib/include/phsup.h index 2d31ef398..6ef601e07 100644 --- a/phlib/include/phsup.h +++ b/phlib/include/phsup.h @@ -464,6 +464,21 @@ FORCEINLINE ULONG PhCountBits( return count; } +FORCEINLINE ULONG PhCountBitsUlongPtr( + _In_ ULONG_PTR Value + ) +{ + ULONG count = 0; + + while (Value) + { + count++; + Value &= Value - 1; + } + + return count; +} + FORCEINLINE ULONG64 PhRoundNumber( _In_ ULONG64 Value, _In_ ULONG64 Granularity