Skip to content

Commit

Permalink
Fix NodeJS and Python bindings on 32-bit systems
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed May 23, 2024
1 parent 4af426d commit 06a486e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bindings/js/minify.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func init() {
}

func goBytes(str *C.char, length C.longlong) []byte {
return (*[1 << 31]byte)(unsafe.Pointer(str))[:length:length]
return (*[1 << 30]byte)(unsafe.Pointer(str))[:length:length]
}

func goStringArray(carr **C.char, length C.longlong) []string {
Expand All @@ -34,7 +34,7 @@ func goStringArray(carr **C.char, length C.longlong) []string {
}

strs := make([]string, length)
arr := (*[1<<31 - 1]*C.char)(unsafe.Pointer(carr))[:length:length]
arr := (*[1 << 30]*C.char)(unsafe.Pointer(carr))[:length:length]
for i := 0; i < int(length); i++ {
strs[i] = C.GoString(arr[i])
}
Expand Down
4 changes: 2 additions & 2 deletions bindings/py/minify.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func init() {
}

func goBytes(str *C.char, length C.longlong) []byte {
return (*[1 << 31]byte)(unsafe.Pointer(str))[:length:length]
return (*[1 << 30]byte)(unsafe.Pointer(str))[:length:length]
}

func goStringArray(carr **C.char, length C.longlong) []string {
Expand All @@ -34,7 +34,7 @@ func goStringArray(carr **C.char, length C.longlong) []string {
}

strs := make([]string, length)
arr := (*[1<<31 - 1]*C.char)(unsafe.Pointer(carr))[:length:length]
arr := (*[1 << 30]*C.char)(unsafe.Pointer(carr))[:length:length]
for i := 0; i < int(length); i++ {
strs[i] = C.GoString(arr[i])
}
Expand Down

0 comments on commit 06a486e

Please sign in to comment.