projects
/
carl9170fw.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wireless: align HE capabilities A-MPDU Length Exponent Extension
[carl9170fw.git]
/
include
/
linux
/
compiler.h
diff --git
a/include/linux/compiler.h
b/include/linux/compiler.h
index cd97693822d7d8f0df3f0aa6f9d03b47ae747bce..e2656ae2cfc198270c956a8cdccdf1fb4139660b 100644
(file)
--- a/
include/linux/compiler.h
+++ b/
include/linux/compiler.h
@@
-111,6
+111,14
@@
static inline unsigned int hweight8(unsigned int w)
return (res + (res >> 4)) & 0x0F;
}
return (res + (res >> 4)) & 0x0F;
}
+static inline unsigned int hweight16(unsigned int w)
+{
+ unsigned int res = w - ((w >> 1) & 0x5555);
+ res = (res & 0x3333) + ((res >> 2) & 0x3333);
+ res = (res + (res >> 4)) & 0x0F0F;
+ return (res + (res >> 8)) & 0x00FF;
+}
+
/**
* DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
*
/**
* DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
*
@@
-127,4
+135,11
@@
static inline unsigned int hweight8(unsigned int w)
TYPE NAME[]; \
}
TYPE NAME[]; \
}
+#define __bf_shf(x) (__builtin_ffsll(x) - 1)
+
+#define FIELD_MAX(_mask) \
+ ({ \
+ (typeof(_mask))((_mask) >> __bf_shf(_mask)); \
+ })
+
#endif /* __SHARED_COMPILER_H */
#endif /* __SHARED_COMPILER_H */