Skip to content

Commit

Permalink
test(lint): Fix int overflow warnings [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Oct 27, 2024
1 parent e9f4260 commit fc72f11
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/game/conway/conway.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ func (c *Conway) Init() tea.Cmd {
func (c *Conway) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tickMsg:
steps := uint(1)
steps := uint64(1)
if speeds[c.speed] < time.Second/240 {
steps += uint(time.Second / 240 / speeds[c.speed])
steps += uint64(time.Second / 240 / speeds[c.speed]) //nolint:gosec
}
c.Pattern.Step(steps)
if c.ctx != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/pattern/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Pattern struct {
Rule rule.Rule
}

func (p Pattern) Step(steps uint) {
func (p Pattern) Step(steps uint64) {
p.Tree.Step(&p.Rule, steps)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/quadtree/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

type Stats struct {
Steps int
Generation uint
Generation uint64
Level int
Population int
memoizer.Stats
Expand Down
4 changes: 2 additions & 2 deletions internal/quadtree/gosper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func New() *Gosper {
type Gosper struct {
resetCells *Node
cells *Node
generation uint
generation uint64
steps int
}

Expand All @@ -35,7 +35,7 @@ func (g *Gosper) Set(p image.Point, v int) {
g.cells = g.cells.Set(p, v)
}

func (g *Gosper) Step(r *rule.Rule, steps uint) {
func (g *Gosper) Step(r *rule.Rule, steps uint64) {
memoizedNew.Cleanup()

g.steps++
Expand Down
2 changes: 1 addition & 1 deletion internal/quadtree/node_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func treeWithRandomPattern(level uint) (*Node, *big.Int) {
node = node.grow()
}
edgeLength := int(1) << level
cellsInTree := uint(edgeLength * edgeLength)
cellsInTree := uint(edgeLength * edgeLength) //nolint:gosec

upperBound := new(big.Int)
upperBound.SetInt64(1)
Expand Down

0 comments on commit fc72f11

Please sign in to comment.