From 2bd86aabc7a0eb9d0f3eaeaef7f4eba63f62bbaa Mon Sep 17 00:00:00 2001 From: lizhanwei <Dana_Lee1016@126.com> Date: 星期三, 08 一月 2020 14:17:58 +0800 Subject: [PATCH] Merge b --- lib/src/main/cpp/utils/num.cpp | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/lib/src/main/cpp/utils/num.cpp b/lib/src/main/cpp/utils/num.cpp index fe14678..0019ccf 100644 --- a/lib/src/main/cpp/utils/num.cpp +++ b/lib/src/main/cpp/utils/num.cpp @@ -74,3 +74,14 @@ return true; } + +int BitCount(uint32_t n) +{ + n = (n &0x55555555) + ((n >>1) &0x55555555); + n = (n &0x33333333) + ((n >>2) &0x33333333); + n = (n &0x0f0f0f0f) + ((n >>4) &0x0f0f0f0f); + n = (n &0x00ff00ff) + ((n >>8) &0x00ff00ff); + n = (n &0x0000ffff) + ((n >>16) &0x0000ffff); + + return n ; +} -- Gitblit v1.8.0