modules/desktop_capture/x11/x_server_pixel_buffer.cc
uint32_t MaskToShift(uint32_t mask) {
  int shift = 0;
  if ((mask & 0xffff0000u) == 0) {
    mask <<= 16;
    shift += 16;
  }
  if ((mask & 0xff000000u) == 0) {
    mask <<= 8;
    shift += 8;
  }
  if ((mask & 0xf0000000u) == 0) {
    mask <<= 4;
    shift += 4;
  }
  if ((mask & 0xc0000000u) == 0) {
    mask <<= 2;
    shift += 2;
  }
  if ((mask & 0x80000000u) == 0)
    shift += 1;

  return shift;
}
// Returns the number of bits |mask| has to be shifted left so its last
// (most-significant) bit set becomes the most-significant bit of the word.
// When |mask| is 0 the function returns 31.
Returns the number of bits |mask| has to be shifted left so its last
(most-significant) bit set becomes the most-significant bit of the word.
When |mask| is 0 the function returns 31.
Returns the number of bits |mask| has to be shifted left so its last ( most - significant ) bit set becomes the most - significant bit of the word . When |mask| is 0 the function returns 31 .
uint32_t MaskToShift(uint32_t mask) {
  int shift = 0;
  if ((mask & 0xffff0000u) == 0) {
    mask <<= 16;
    shift += 16;
  }
  if ((mask & 0xff000000u) == 0) {
    mask <<= 8;
    shift += 8;
  }
  if ((mask & 0xf0000000u) == 0) {
    mask <<= 4;
    shift += 4;
  }
  if ((mask & 0xc0000000u) == 0) {
    mask <<= 2;
    shift += 2;
  }
  if ((mask & 0x80000000u) == 0)
    shift += 1;
  return shift;
}
uint32_t MaskToShift ( uint32_t mask ) { int shift = 0 ; if ( ( mask & 0xffff0000u ) == 0 ) { mask <<= 16 ; shift += 16 ; } if ( ( mask & 0xff000000u ) == 0 ) { mask <<= 8 ; shift += 8 ; } if ( ( mask & 0xf0000000u ) == 0 ) { mask <<= 4 ; shift += 4 ; } if ( ( mask & 0xc0000000u ) == 0 ) { mask <<= 2 ; shift += 2 ; } if ( ( mask & 0x80000000u ) == 0 ) shift += 1 ; return shift ; }
Returns the number of bits |mask| has to be shifted left so its last
(most-significant) bit set becomes the most-significant bit of the word.
Returns the number of bits |mask| has to be shifted left so its last ( most - significant ) bit set becomes the most - significant bit of the word .