|  | @@ -34,6 +34,8 @@
 | 
	
		
			
				|  |  |  #ifndef GRPC_SUPPORT_USEFUL_H
 | 
	
		
			
				|  |  |  #define GRPC_SUPPORT_USEFUL_H
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +#include <grpc/support/port_platform.h>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  /* useful macros that don't belong anywhere else */
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  #define GPR_MIN(a, b) ((a) < (b) ? (a) : (b))
 | 
	
	
		
			
				|  | @@ -61,4 +63,11 @@
 | 
	
		
			
				|  |  |  /** Get the \a n-th bit of \a i */
 | 
	
		
			
				|  |  |  #define GPR_BITGET(i, n) (((i) & (1u << n)) != 0)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +/** Returns number of bits set in bitset \a i */
 | 
	
		
			
				|  |  | +int gpr_bitcount(gpr_uint32 i) {
 | 
	
		
			
				|  |  | +  i = i - ((i >> 1) & 0x55555555);
 | 
	
		
			
				|  |  | +  i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
 | 
	
		
			
				|  |  | +  return (((i + (i >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  #endif  /* GRPC_SUPPORT_USEFUL_H */
 |