diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/AudioMixer.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index d994a87..fb1ca87 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -95,16 +95,11 @@ AudioMixer::~AudioMixer() int AudioMixer::getTrackName() { - uint32_t names = mTrackNames; - uint32_t mask = 1; - int n = 0; - while (names & mask) { - mask <<= 1; - n++; - } - if (mask) { + uint32_t names = ~mTrackNames; + if (names != 0) { + int n = __builtin_ctz(names); ALOGV("add track (%d)", n); - mTrackNames |= mask; + mTrackNames |= 1 << n; return TRACK0 + n; } return -1; |