Skip to content

Commit

Permalink
Use a narrower type for MicroProfileLogGetType.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenoArrows authored and jonasmr committed Dec 17, 2023
1 parent 5781078 commit b77e583
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions microprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ template <typename T>
T MicroProfileClamp(T a, T min_, T max_);
int64_t MicroProfileMsToTick(float fMs, int64_t nTicksPerSecond);
float MicroProfileTickToMsMultiplier(int64_t nTicksPerSecond);
uint64_t MicroProfileLogGetType(MicroProfileLogEntry Index);
uint32_t MicroProfileLogGetType(MicroProfileLogEntry Index);
uint64_t MicroProfileLogGetTimerIndex(MicroProfileLogEntry Index);
MicroProfileLogEntry MicroProfileMakeLogIndex(uint64_t nBegin, MicroProfileToken nToken, int64_t nTick);
int64_t MicroProfileLogTickDifference(MicroProfileLogEntry Start, MicroProfileLogEntry End);
Expand Down Expand Up @@ -1052,7 +1052,7 @@ struct MicroProfile
MicroProfileGpuTimerState* pGPU;
};

inline uint64_t MicroProfileLogGetType(MicroProfileLogEntry Index)
inline uint32_t MicroProfileLogGetType(MicroProfileLogEntry Index)
{
return ((MP_LOG_BEGIN_MASK & Index) >> 62) & 0x3;
}
Expand Down Expand Up @@ -1101,7 +1101,7 @@ MicroProfileLogEntry MicroProfileMakeLogExtendedNoData(EMicroProfileTokenExtende
inline MicroProfileLogEntry MicroProfileMakeLogIndex(uint64_t nBegin, MicroProfileToken nToken, int64_t nTick)
{
MicroProfileLogEntry Entry = (nBegin << 62) | ((0x3fff & nToken) << 48) | (MP_LOG_TICK_MASK & nTick);
uint64_t t = MicroProfileLogGetType(Entry);
uint32_t t = MicroProfileLogGetType(Entry);
uint64_t nTimerIndex = MicroProfileLogGetTimerIndex(Entry);
MP_ASSERT(t == nBegin);
MP_ASSERT(nTimerIndex == (nToken & 0x3fff));
Expand Down Expand Up @@ -3367,7 +3367,7 @@ void MicroProfileFlip_CB(void* pContext, MicroProfileOnFreeze FreezeCB)
{
int64_t LE = pLog->Log[nStart];
int64_t nDifference = MicroProfileLogTickDifference(LE, nTickEndFrame);
uint64_t Ext = MicroProfileLogGetType(LE);
uint32_t Ext = MicroProfileLogGetType(LE);
if(nDifference > 0 || 0 != (0x2 & Ext))
{
nStart = (nStart + 1) % MICROPROFILE_BUFFER_SIZE;
Expand Down Expand Up @@ -3510,7 +3510,7 @@ void MicroProfileFlip_CB(void* pContext, MicroProfileOnFreeze FreezeCB)
for(uint32_t k = nStart; k < nEnd; ++k)
{
MicroProfileLogEntry LE = pLog->Log[k];
uint64_t nType = MicroProfileLogGetType(LE);
uint32_t nType = MicroProfileLogGetType(LE);

switch(nType)
{
Expand Down Expand Up @@ -5019,7 +5019,7 @@ void MicroProfileDumpHtml(MicroProfileWriteCallback CB, void* Handle, uint64_t n
int64_t nStartTickBase = pLog->nGpu ? nTickStartGpu : nTickStart;
uint32_t nLogStart = S.Frames[nFrameIndex].nLogStart[j];
uint32_t nLogEnd = S.Frames[nFrameIndexNext].nLogStart[j];
uint64_t nLogType;
uint32_t nLogType;
float fToMs;
uint64_t nStartTick;
float fToMsCpu = MicroProfileTickToMsMultiplier(nTicksPerSecondCpu);
Expand Down Expand Up @@ -5074,7 +5074,7 @@ void MicroProfileDumpHtml(MicroProfileWriteCallback CB, void* Handle, uint64_t n
for(k = (k + 1) % MICROPROFILE_BUFFER_SIZE; k != nLogEnd; k = (k + 1) % MICROPROFILE_BUFFER_SIZE)
{
uint64_t v = pLog->Log[k];
uint64_t nLogType2 = MicroProfileLogGetType(v);
uint32_t nLogType2 = MicroProfileLogGetType(v);

if(nLogType2 > MP_LOG_ENTER)
nLogType2 |= (MicroProfileLogGetExtendedToken(v))
Expand Down

0 comments on commit b77e583

Please sign in to comment.