summaryrefslogtreecommitdiff
path: root/include/media/ir-core.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/ir-core.h')
-rw-r--r--include/media/ir-core.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index bff75f258fbc..53048a2eefb9 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -212,4 +212,23 @@ static inline void ir_raw_event_reset(struct input_dev *input_dev)
ir_raw_event_handle(input_dev);
}
+
+/* extract mask bits out of data and pack them into the result */
+static inline u32 ir_extract_bits(u32 data, u32 mask)
+{
+ u32 vbit = 1, value = 0;
+
+ do {
+ if (mask & 1) {
+ if (data & 1)
+ value |= vbit;
+ vbit <<= 1;
+ }
+ data >>= 1;
+ } while (mask >>= 1);
+
+ return value;
+}
+
+
#endif /* _IR_CORE */