only check bitlen once

This commit is contained in:
David 2021-12-03 19:08:25 -05:00
parent f6abc0c6e1
commit 0f3f6f2875

View File

@ -62,12 +62,14 @@ func partTwo() {
inputs := []int64{}
var oxgen, co2scrub int64
var bitlen int64
var bitlen int
for scanner.Scan() {
line := scanner.Text()
if bitlen == 0 {
bitlen = len(line)
}
n, _ := strconv.ParseInt(line, 2, 64)
inputs = append(inputs, n)
bitlen = int64(len(line))
}
// on initial loop, oxgen>>i == n>>i etc always come out to 0 == 0