From 89c9c19446843c978485f67eeaa3d55ac26a15ec Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 23 Jul 2017 22:29:57 -0400 Subject: scaninc: faster incbin detection --- tools/scaninc/c_file.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/scaninc/c_file.cpp b/tools/scaninc/c_file.cpp index 2dd400967..2d3f8749a 100644 --- a/tools/scaninc/c_file.cpp +++ b/tools/scaninc/c_file.cpp @@ -237,6 +237,18 @@ void CFile::CheckInclude() void CFile::CheckIncbin() { + // Optimization: assume most lines are not incbins + if (!(m_buffer[m_pos+0] == 'I' + && m_buffer[m_pos+1] == 'N' + && m_buffer[m_pos+2] == 'C' + && m_buffer[m_pos+3] == 'B' + && m_buffer[m_pos+4] == 'I' + && m_buffer[m_pos+5] == 'N' + && m_buffer[m_pos+6] == '_')) + { + return; + } + std::string idents[6] = { "INCBIN_S8", "INCBIN_U8", "INCBIN_S16", "INCBIN_U16", "INCBIN_S32", "INCBIN_U32" }; int incbinType = -1; -- cgit v1.2.3