Fix checkSupportFeatures function 15/159615/4
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Thu, 10 Mar 2016 11:27:34 +0000 (14:27 +0300)
committerVitaliy Cherepanov <v.cherepanov@samsung.com>
Thu, 16 Nov 2017 13:21:20 +0000 (13:21 +0000)
Wrong unsupported features calculation.

Change-Id: I608b8caa09010cfe3f956999349d0756697f4479
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
daemon/cpp/features/feature_manager_c.cpp

index 9ff66d40b6a7acd82c18663ee5ffce6cb3728b90..8384582a4b26c3525880f2cd646f79bc0573f8d7 100644 (file)
@@ -96,18 +96,17 @@ extern "C" int fm_stop(void)
     return 0;
 }
 
-static uint64_t checkSupportFeatures(uint64_t f, uint64_t fs, size_t offset)
+static uint64_t checkSupportFeatures(uint64_t requested,
+                                     uint64_t supported, size_t offset)
 {
-    if (f != fs) {
-        uint64_t diff = f ^ fs;
+    uint64_t unsupported = requested & (~supported);
 
-        for (int i = 0; diff; diff >>= 1, ++i) {
-            if (diff & 1)
-                LOGW("feature[%d] is not support\n", i + offset);
-        }
+    for (int i = 0; unsupported; unsupported >>= 1, ++i) {
+        if (unsupported & 1)
+            LOGW("feature[%d] is not support\n", i + offset);
     }
 
-    return f & fs;
+    return requested & supported;
 }
 
 extern "C" int fm_set(uint64_t f0, uint64_t f1)