Use prefix add operator for non-prim types

Typically yields better or equal performance. Sometimes compilers don't
optimizer out keeping the previous values (not needed for only adding 1)
This commit is contained in:
Mystro256 2017-02-17 23:50:00 -05:00 committed by Rafael Kitover
parent 7c06968557
commit fa1e13e606
3 changed files with 13 additions and 13 deletions

View File

@ -43,7 +43,7 @@ const
w->SetExtraStyle(w->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
wxWindowList l = w->GetChildren();
for (wxWindowList::iterator ch = l.begin(); ch != l.end(); ch++)
for (wxWindowList::iterator ch = l.begin(); ch != l.end(); ++ch)
mark_recursive(*ch);
}
@ -2020,7 +2020,7 @@ public:
// first drop from user accels, if applicable
for (wxAcceleratorEntry_v::iterator i = user_accels.begin();
i < user_accels.end(); i++)
i < user_accels.end(); ++i)
if (i->GetFlags() == selmod && i->GetKeyCode() == selkey) {
user_accels.erase(i);
break;
@ -2037,7 +2037,7 @@ public:
// finally, remove from accels instead of recomputing
for (wxAcceleratorEntry_v::iterator i = accels.begin();
i < accels.end(); i++)
i < accels.end(); ++i)
if (i->GetFlags() == selmod && i->GetKeyCode() == selkey) {
accels.erase(i);
break;
@ -2081,7 +2081,7 @@ public:
// first drop from user accels, if applicable
for (wxAcceleratorEntry_v::iterator i = user_accels.begin();
i < user_accels.end(); i++)
i < user_accels.end(); ++i)
if (i->GetFlags() == acmod && i->GetKeyCode() == ackey) {
user_accels.erase(i);
break;
@ -2149,7 +2149,7 @@ void MainFrame::add_menu_accels(wxTreeCtrl* tc, wxTreeItemId& parent, wxMenu* me
{
wxMenuItemList mil = menu->GetMenuItems();
for (wxMenuItemList::iterator mi = mil.begin(); mi != mil.end(); mi++) {
for (wxMenuItemList::iterator mi = mil.begin(); mi != mil.end(); ++mi) {
if ((*mi)->IsSeparator()) {
tc->AppendItem(parent, wxT("-----"));
} else if ((*mi)->IsSubMenu()) {
@ -2374,7 +2374,7 @@ wxAcceleratorEntry_v MainFrame::get_accels(wxAcceleratorEntry_v user_accels)
for (int i = 0; i < user_accels.size(); i++) {
const wxAcceleratorEntry& ae = user_accels[i];
for (wxAcceleratorEntry_v::iterator e = accels.begin(); e < accels.end(); e++)
for (wxAcceleratorEntry_v::iterator e = accels.begin(); e < accels.end(); ++e)
if (ae.GetFlags() == e->GetFlags() && ae.GetKeyCode() == e->GetKeyCode()) {
accels.erase(e);
break;
@ -2636,7 +2636,7 @@ bool MainFrame::BindControls()
// only add it if not already there
for (wxAcceleratorEntry_v::iterator e = sys_accels.begin();
e < sys_accels.end(); e++)
e < sys_accels.end(); ++e)
if (a->GetFlags() == e->GetFlags() && a->GetKeyCode() == e->GetKeyCode()) {
if (e->GetMenuItem()) {
wxLogInfo(_("Duplicate menu accelerator: %s for %s and %s; keeping first"),

View File

@ -746,7 +746,7 @@ void update_opts()
cfg->SetPath(wxT("/Keyboard"));
for (wxAcceleratorEntry_v::iterator i = gopts.accels.begin();
i < gopts.accels.end(); i++) {
i < gopts.accels.end(); ++i) {
int cmd_id = i->GetCommand();
int cmd;
@ -756,7 +756,7 @@ void update_opts()
wxAcceleratorEntry_v::iterator j;
for (j = i + 1; j < gopts.accels.end(); j++)
for (j = i + 1; j < gopts.accels.end(); ++j)
if (j->GetCommand() != cmd_id)
break;
@ -880,11 +880,11 @@ bool opt_set(const wxChar* name, const wxChar* val)
return false;
for (wxAcceleratorEntry_v::iterator i = gopts.accels.begin();
i < gopts.accels.end(); i++)
i < gopts.accels.end(); ++i)
if (i->GetCommand() == cmd->cmd_id) {
wxAcceleratorEntry_v::iterator j;
for (j = i; j < gopts.accels.end(); j++)
for (j = i; j < gopts.accels.end(); ++j)
if (j->GetCommand() != cmd->cmd_id)
break;

View File

@ -9,7 +9,7 @@ void Viewer::CloseDlg(wxCloseEvent& ev)
MainFrame* f = wxGetApp().frame;
for (dialog_list_t::iterator i = f->popups.begin();
i != f->popups.end(); i++)
i != f->popups.end(); ++i)
if (*i == this) {
f->popups.erase(i);
break;
@ -63,7 +63,7 @@ END_EVENT_TABLE()
void MainFrame::UpdateViewers()
{
for (dialog_list_t::iterator i = popups.begin(); i != popups.end(); i++) {
for (dialog_list_t::iterator i = popups.begin(); i != popups.end(); ++i) {
Viewers::Viewer* d = static_cast<Viewers::Viewer*>(*i);
if (d->auto_update)