mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
Revert "bitmap: fix memset optimization on big-endian systems"
This reverts commit ac5a36bb69570bc5bdd68f21c6793abc0b110cb7. Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com> Signed-off-by: alk3pInjection <webmaster@raspii.tech> Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
parent
9ff6a40ee8
commit
2348f797a4
@ -275,20 +275,12 @@ static inline void bitmap_complement(unsigned long *dst, const unsigned long *sr
|
||||
__bitmap_complement(dst, src, nbits);
|
||||
}
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
#define BITMAP_MEM_ALIGNMENT 8
|
||||
#else
|
||||
#define BITMAP_MEM_ALIGNMENT (8 * sizeof(unsigned long))
|
||||
#endif
|
||||
#define BITMAP_MEM_MASK (BITMAP_MEM_ALIGNMENT - 1)
|
||||
|
||||
static inline int bitmap_equal(const unsigned long *src1,
|
||||
const unsigned long *src2, unsigned int nbits)
|
||||
{
|
||||
if (small_const_nbits(nbits))
|
||||
return !((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
|
||||
if (__builtin_constant_p(nbits & BITMAP_MEM_MASK) &&
|
||||
IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
|
||||
if (__builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8))
|
||||
return !memcmp(src1, src2, nbits / 8);
|
||||
return __bitmap_equal(src1, src2, nbits);
|
||||
}
|
||||
@ -339,10 +331,8 @@ static __always_inline void bitmap_set(unsigned long *map, unsigned int start,
|
||||
{
|
||||
if (__builtin_constant_p(nbits) && nbits == 1)
|
||||
__set_bit(start, map);
|
||||
else if (__builtin_constant_p(start & BITMAP_MEM_MASK) &&
|
||||
IS_ALIGNED(start, BITMAP_MEM_ALIGNMENT) &&
|
||||
__builtin_constant_p(nbits & BITMAP_MEM_MASK) &&
|
||||
IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
|
||||
else if (__builtin_constant_p(start & 7) && IS_ALIGNED(start, 8) &&
|
||||
__builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8))
|
||||
memset((char *)map + start / 8, 0xff, nbits / 8);
|
||||
else
|
||||
__bitmap_set(map, start, nbits);
|
||||
@ -353,10 +343,8 @@ static __always_inline void bitmap_clear(unsigned long *map, unsigned int start,
|
||||
{
|
||||
if (__builtin_constant_p(nbits) && nbits == 1)
|
||||
__clear_bit(start, map);
|
||||
else if (__builtin_constant_p(start & BITMAP_MEM_MASK) &&
|
||||
IS_ALIGNED(start, BITMAP_MEM_ALIGNMENT) &&
|
||||
__builtin_constant_p(nbits & BITMAP_MEM_MASK) &&
|
||||
IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
|
||||
else if (__builtin_constant_p(start & 7) && IS_ALIGNED(start, 8) &&
|
||||
__builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8))
|
||||
memset((char *)map + start / 8, 0, nbits / 8);
|
||||
else
|
||||
__bitmap_clear(map, start, nbits);
|
||||
|
Loading…
x
Reference in New Issue
Block a user