[vlc-commits] [Git][videolan/vlc][master] qml: correct used algorithm for isSortedIntegerArrayConsecutive()
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Oct 20 08:05:17 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
c576d84c by Fatih Uzunoglu at 2023-10-20T07:43:57+00:00
qml: correct used algorithm for isSortedIntegerArrayConsecutive()
- - - - -
1 changed file:
- modules/gui/qt/util/qml/Helpers.js
Changes:
=====================================
modules/gui/qt/util/qml/Helpers.js
=====================================
@@ -85,21 +85,12 @@ function alignDown(a, b) {
}
function isSortedIntegerArrayConsecutive(array) {
- const length = array.length
+ for (let i = 1; i < array.length; ++i) {
+ if ((array[i] - array[i - 1]) !== 1)
+ return false
+ }
- if (length <= 1)
- return true
-
- const first = array[0]
- const last = array[length - 1]
-
- if (length === 2)
- return Math.abs(first - last) === 1
-
- const sum1 = array.reduce((i, j) => i + j)
- const sum2 = length * (first + last) / 2
-
- return (sum1 === sum2)
+ return true
}
function itemsMovable(sortedItemIndexes, targetIndex) {
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c576d84c3ceab8fd350f7fba0c1ca8392f515352
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c576d84c3ceab8fd350f7fba0c1ca8392f515352
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list