mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2025-01-09 22:30:47 +00:00
22 lines
289 B
Go
22 lines
289 B
Go
|
package two
|
||
|
|
||
|
const empty = -1
|
||
|
|
||
|
type block struct {
|
||
|
used int
|
||
|
free []int
|
||
|
offset int
|
||
|
}
|
||
|
|
||
|
func newBlock(used, start, end int) block {
|
||
|
return block{
|
||
|
used: used,
|
||
|
free: []int{start, start + end},
|
||
|
offset: 0,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (b *block) available() int {
|
||
|
return b.free[1] - b.free[0]
|
||
|
}
|