Skip to content

Commit

Permalink
Fix build for 386 and add build.yml workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed May 17, 2024
1 parent eb70f94 commit cae6003
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-versions: [ '1.18', '1.22' ]
go-arch: [ '386' ]
steps:
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Build
run: GOARCH=${{ matrix.go-arch }} go build
6 changes: 2 additions & 4 deletions compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,7 @@ func (c *compiler) IntegerNode(node *ast.IntegerNode) {
}
c.emitPush(int32(node.Value))
case reflect.Int64:
if node.Value > math.MaxInt64 || node.Value < math.MinInt64 {
panic(fmt.Sprintf("constant %d overflows int64", node.Value))
}
panic(fmt.Sprintf("constant %d overflows int64", node.Value))
c.emitPush(int64(node.Value))
case reflect.Uint:
if node.Value < 0 {
Expand All @@ -365,7 +363,7 @@ func (c *compiler) IntegerNode(node *ast.IntegerNode) {
}
c.emitPush(uint16(node.Value))
case reflect.Uint32:
if node.Value > math.MaxUint32 || node.Value < 0 {
if node.Value < 0 {
panic(fmt.Sprintf("constant %d overflows uint32", node.Value))
}
c.emitPush(uint32(node.Value))
Expand Down

0 comments on commit cae6003

Please sign in to comment.