AND bit a bit de números no intervalo

A função recebe dois números begin, end que definem um intervalo de números, ambos inclusivos. A partir de begin, aplica a operação bit a bit & ao próximo número até chegar a end para calcular o resultado e retorná-lo.

Exemplos

bitwise_and(0, 1) ➞ 0
# input  = 0:0b0 & 1:0b1
# output = 0:0b0

bitwise_and(1, 1) ➞ 1
# input  = 1:0b1
# output = 1:0b1

bitwise_and(5, 7) ➞ 4
# input  = 5:0b101 & 6:0b110 & 7:0b111
# output = 4:0b100

bitwise_and(19, 22) ➞ 16
# input  = 19:0b10011 & 20:0b10100 & 21:0b10101 & 22:0b10110
# output = 16:0b10000

Notas

N/A