Skip to content

Commit

Permalink
Fix Monitor ID bitmask
Browse files Browse the repository at this point in the history
The bitmask used to separate the MonitorID field from everything else in
the BeamMonitor packets was off by one bit.  Since the MonitorID field
is actually the top 10 bits the mask wasn't even needed (just a right
shift operation).

Refs #9563
  • Loading branch information
rgmiller committed Jun 4, 2014
1 parent 35c19ac commit b1bedd2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/LiveData/src/ADARA/ADARAPackets.cpp
Expand Up @@ -266,7 +266,6 @@ BeamMonitorPkt::BeamMonitorPkt(const BeamMonitorPkt &pkt) :
Packet(pkt), m_fields((const uint32_t *)payload()), m_sectionStartIndex(0)
{}

#define MONITOR_ID_MASK 0xFFA00000 // upper 10 bits
#define EVENT_COUNT_MASK 0x003FFFFF // lower 22 bits
bool BeamMonitorPkt::nextSection() const
// Returns true if there is a next section. False if there isn't.
Expand Down Expand Up @@ -295,7 +294,8 @@ bool BeamMonitorPkt::nextSection() const

uint32_t BeamMonitorPkt::getSectionMonitorID() const
{
return (m_fields[m_sectionStartIndex] & MONITOR_ID_MASK) >> 22;
// Monitor ID is the upper 10 bits
return (m_fields[m_sectionStartIndex] >> 22);
}

uint32_t BeamMonitorPkt::getSectionEventCount() const
Expand Down

0 comments on commit b1bedd2

Please sign in to comment.