Sets the i-bit of self to the given value

assert 11.setbit(0, 0) == 10
 assert 10.setbit(0, 1) == 11

Property definitions

core :: bitset $ Int :: setbit
	# Sets the i-bit of self to the given `value`
	#
	#	 assert 11.setbit(0, 0) == 10
	#	 assert 10.setbit(0, 1) == 11
	fun setbit(index: Int, value: Int): Int `{
		assert(index >= 0 && index < 32);

		if(value == 1)
			return self | (1 << index);
		else
			return self & ~(1 << index);
	`}
lib/core/bitset.nit:31,2--42,3