13
0

move check for n_speakers so that we avoid needless work

This commit is contained in:
Paul Davis 2014-01-29 15:50:17 -05:00
parent 2d8352123a
commit 66d0241118

View File

@ -116,6 +116,11 @@ VBAPSpeakers::choose_speaker_triplets(struct ls_triplet_chain **ls_triplets)
int i,j,k,l,table_size;
int n_speakers = _speakers.size ();
if (n_speakers == 0) {
return;
}
/* variable length arrays arrived in C99, became optional in C11, and
are only planned for C++14. Use alloca which is functionally
identical (but uglier to read).
@ -131,10 +136,6 @@ VBAPSpeakers::choose_speaker_triplets(struct ls_triplet_chain **ls_triplets)
connections[i] = 0;
}
if (n_speakers == 0) {
return;
}
for (i = 0; i < n_speakers; i++) {
for (j = i+1; j < n_speakers; j++) {
for(k = j+1; k < n_speakers; k++) {