afl-fuzz.c
static u32 count_bits(u8* mem) {

  u32* ptr = (u32*)mem;
  u32  i   = (afl_map_size >> 2);
  u32  ret = 0;

  while (i--) {

    u32 v = *(ptr++);

    /* This gets called on the inverse, virgin bitmap; optimize for sparse
       data. */

    if (v == 0xffffffff) {
      ret += 32;
      continue;
    }

    v -= ((v >> 1) & 0x55555555);
    v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
    ret += (((v + (v >> 4)) & 0xF0F0F0F) * 0x01010101) >> 24;

  }

  return ret;

}
/* Count the number of bits set in the provided bitmap. Used for the status
   screen several times every second, does not have to be fast. */
Count the number of bits set in the provided bitmap. Used for the status
screen several times every second, does not have to be fast.
Count the number of bits set in the provided bitmap . Used for the status screen several times every second does not have to be fast .
static u32 count_bits(u8* mem) {
  u32* ptr = (u32*)mem;
  u32  i   = (afl_map_size >> 2);
  u32  ret = 0;
  while (i--) {
    u32 v = *(ptr++);
    if (v == 0xffffffff) {
      ret += 32;
      continue;
    }
    v -= ((v >> 1) & 0x55555555);
    v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
    ret += (((v + (v >> 4)) & 0xF0F0F0F) * 0x01010101) >> 24;
  }
  return ret;
}
static u32 count_bits ( u8 * mem ) { u32 * ptr = ( u32 * ) mem ; u32 i = ( afl_map_size >> 2 ) ; u32 ret = 0 ; while ( i -- ) { u32 v = * ( ptr ++ ) ; if ( v == 0xffffffff ) { ret += 32 ; continue ; } v -= ( ( v >> 1 ) & 0x55555555 ) ; v = ( v & 0x33333333 ) + ( ( v >> 2 ) & 0x33333333 ) ; ret += ( ( ( v + ( v >> 4 ) ) & 0xF0F0F0F ) * 0x01010101 ) >> 24 ; } return ret ; }
Count the number of bits set in the provided bitmap.
Count the number of bits set in the provided bitmap .
/* This gets called on the inverse, virgin bitmap; optimize for sparse
       data. */