Returns the position of the highest bit set to 1 in self

The rightmost bit is at position 0.

assert 10.highest_bit == 3
 assert 1.highest_bit == 0

Property definitions

core :: bitset $ Int :: highest_bit
	# Returns the position of the highest bit set to 1 in `self`
	#
	# The rightmost bit is at position 0.
	#
	#	 assert 10.highest_bit == 3
	#	 assert 1.highest_bit == 0
	fun highest_bit: Int `{
		long int msb = 1L << 31;
		int pos = 31;

		while(msb > 0 && !(self & msb))
		{
			msb /= 2;
			pos--;
		}

		return pos;
	`}
lib/core/bitset.nit:102,2--119,3