NONPAGED void IncrementBucket()

in rtl/inc/khistogram.h [100:121]


    NONPAGED void IncrementBucket(ULONG64 index)
    {
        WIN_ASSERT(index < m_numBuckets);

        auto &value = m_buckets[static_cast<size_t>(index)];

#ifndef _X86_
        auto inc = InterlockedIncrementNoFence16(reinterpret_cast<SHORT*>(&value));
#else
        auto inc = InterlockedIncrement16(reinterpret_cast<SHORT*>(&value));
#endif

        // Avoid wraparound
        if (static_cast<USHORT>(inc) > 0xFF00)
        {
#ifndef _X86_
            InterlockedDecrementNoFence16(reinterpret_cast<SHORT*>(&value));
#else
            InterlockedDecrement16(reinterpret_cast<SHORT*>(&value));
#endif
        }
    }