Micro optimization in wxDisplay ctor

Don't check for the index validity if it's 0, which is the most common
case, as index 0 is always valid and so we can avoid calling GetCount(),
which might have a non-trivial cost, completely.
This commit is contained in:
Vadim Zeitlin
2018-09-29 23:01:36 +02:00
parent 141d7b826d
commit 77e33d9e1b

View File

@@ -115,7 +115,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxDisplayModule, wxModule);
wxDisplay::wxDisplay(unsigned n)
{
wxASSERT_MSG( n < GetCount(),
wxASSERT_MSG( n == 0 || n < GetCount(),
wxT("An invalid index was passed to wxDisplay") );
m_impl = Factory().CreateDisplay(n);