-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some more issues #573
Fix some more issues #573
Conversation
Can you take particular care checking the RDM sniffer stuff @nomis52 as I don't have a way to test it. |
LGTM |
@@ -327,8 +333,8 @@ void RDMSniffer::DisplayDmxFrame() { | |||
void RDMSniffer::DisplayAlternateFrame() { | |||
unsigned int slot_count = m_frame.Size() - 1; | |||
MaybePrintTimestamp(); | |||
cout << "SC 0x" << std::hex << std::setw(2) << static_cast<int>(m_frame[0]) | |||
<< " " << std::dec << slot_count << ":" << std::hex; | |||
cout << "SC " << IntToHexString(m_frame[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want IntToHexString(m_frame[0], 2) here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also IntToHexString is rather expensive. I'd probably stick to what we had here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because m_frame is a uint8_t, it will use that version of IntToHexString surely, passing in 8/4=2. Is the expense just creating the ostringstream? Would making it inline guarantee the compiler optimised it? Alternatively, what if I did a version where you could pass in a pointer to a stream (e.g. cout) like the FormatData function? Also just noticed the old code missed the zero padding bit that IntToHexString does.
Were you still planning to make the change I sent you on irc? |
Yep, I just got distracted fixing bugs in #575 . |
I think this is ready to merge if you're happy @nomis52 . I guess I should switch IntToHexString to use ToHex internally too, and perhaps deprecate it? |
*/ | ||
template<typename T> | ||
_ToHex<T> ToHex(T v, bool prefix = true) { | ||
// TODO(Peter): This may break if we get a type that doesn't have digits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine, it's a compile time error. You can remove the TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
LGTM |
No description provided.