From 2feba9b582ea9fb59e3911fa804719202c2b3cde Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Mon, 16 May 2022 19:20:35 -0500 Subject: [PATCH] Decrease fingerprinting time by 10x --- .../ScheduledTasks/FingerprinterTask.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs index 1eccd9e..9b60a03 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Numerics; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Tasks; @@ -415,18 +416,7 @@ public class FingerprinterTask : IScheduledTask /// Number of bits that are equal to 1. public static int CountBits(uint number) { - var count = 0; - - for (var i = 0; i < 32; i++) - { - var low = (number >> i) & 1; - if (low == 1) - { - count++; - } - } - - return count; + return BitOperations.PopCount(number); } ///