only check bitlen once
This commit is contained in:
parent
f6abc0c6e1
commit
0f3f6f2875
@ -62,12 +62,14 @@ func partTwo() {
|
|||||||
inputs := []int64{}
|
inputs := []int64{}
|
||||||
var oxgen, co2scrub int64
|
var oxgen, co2scrub int64
|
||||||
|
|
||||||
var bitlen int64
|
var bitlen int
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
|
if bitlen == 0 {
|
||||||
|
bitlen = len(line)
|
||||||
|
}
|
||||||
n, _ := strconv.ParseInt(line, 2, 64)
|
n, _ := strconv.ParseInt(line, 2, 64)
|
||||||
inputs = append(inputs, n)
|
inputs = append(inputs, n)
|
||||||
bitlen = int64(len(line))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// on initial loop, oxgen>>i == n>>i etc always come out to 0 == 0
|
// on initial loop, oxgen>>i == n>>i etc always come out to 0 == 0
|
||||||
|
Loading…
Reference in New Issue
Block a user