summaryrefslogtreecommitdiff
path: root/tools/scaninc/c_file.cpp
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2017-07-23 22:29:57 -0400
committeryenatch <yenatch@gmail.com>2017-07-23 22:29:57 -0400
commit89c9c19446843c978485f67eeaa3d55ac26a15ec (patch)
treeffde94ab11ef9bcd49aa5e01665ddb1e9ba18969 /tools/scaninc/c_file.cpp
parent7451ea31c62604cc3a96fa9c4123aea3cc5b5cb6 (diff)
scaninc: faster incbin detection
Diffstat (limited to 'tools/scaninc/c_file.cpp')
-rw-r--r--tools/scaninc/c_file.cpp12
1 files changed, 12 insertions, 0 deletions
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;