Skip to content

Commit

Permalink
Fix simpler method to find int size
Browse files Browse the repository at this point in the history
previous didn't work on 32bit (I'm so sorry)

make sure it works ok on 32-bit (go playground):

http://play.golang.org/p/Hceoxd9J_h
  • Loading branch information
anlhord committed Jan 28, 2015
1 parent a6511de commit 4140535
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion utils/buffer/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var Arch64Bits bool
var Arch32Bits bool

func init() {
if int(^0) == 0xffffffff {
if 0 == ^uint(0xffffffff) {
sizeOfInt = 4
} else {
sizeOfInt = 8
Expand Down
2 changes: 1 addition & 1 deletion value.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var sizeOfInt32 = uintptr(4)
var sizeOfInt64 = uintptr(8)

func init() {
if int(^0) == 0xffffffff {
if 0 == ^uint(0xffffffff) {
sizeOfInt = 4
} else {
sizeOfInt = 8
Expand Down

0 comments on commit 4140535

Please sign in to comment.