yaffs Fixed some bugs in direct/timothy_tests/mirror_tests
[yaffs2.git] / yaffs_bitmap.c
index 9fe4032..7df42cd 100644 (file)
@@ -17,7 +17,7 @@
  * Chunk bitmap manipulations
  */
 
-static Y_INLINE u8 *yaffs_block_bits(struct yaffs_dev *dev, int blk)
+static inline u8 *yaffs_block_bits(struct yaffs_dev *dev, int blk)
 {
        if (blk < dev->internal_start_block || blk > dev->internal_end_block) {
                yaffs_trace(YAFFS_TRACE_ERROR,
@@ -90,15 +90,9 @@ int yaffs_count_chunk_bits(struct yaffs_dev *dev, int blk)
        u8 *blk_bits = yaffs_block_bits(dev, blk);
        int i;
        int n = 0;
-       for (i = 0; i < dev->chunk_bit_stride; i++) {
-               u8 x = *blk_bits;
-               while (x) {
-                       if (x & 1)
-                               n++;
-                       x >>= 1;
-               }
 
-               blk_bits++;
-       }
+       for (i = 0; i < dev->chunk_bit_stride; i++, blk_bits++)
+               n += hweight8(*blk_bits);
+
        return n;
 }