build: silence sign promotion warnings

This commit is contained in:
Danny Robson 2014-07-02 15:38:05 +10:00
parent 5da7b87c4a
commit 5a7ff4d20a
2 changed files with 8 additions and 6 deletions

View File

@ -14,12 +14,14 @@ using namespace std;
debug::backtrace::backtrace (void):
m_frames (DEFAULT_DEPTH) {
int final;
while ((final = ::backtrace (&m_frames[0], m_frames.size ())) == sign_cast<ssize_t> (m_frames.size ()))
m_frames.resize (m_frames.size () * 2);
size_t last;
size_t size = m_frames.size ();
CHECK_HARD (final > 0);
m_frames.resize ((unsigned)final);
while ((last = ::backtrace (&m_frames[0], m_frames.size ())) == size)
m_frames.resize (size = m_frames.size () * 2);
CHECK_HARD (last > 0);
m_frames.resize (last);
}

View File

@ -26,7 +26,7 @@ bsdsum (const void *restrict _data, size_t size) {
uint16_t accum = 0;
for (size_t i = 0; i < size; ++i) {
accum = (accum >> 1) | ((accum & 0x1) << 15);
accum = (accum >> 1u) | ((accum & 0x01u) << 15u);
accum += data[i];
}