Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 32-bit architectures? #46

Closed
jas4711 opened this issue Nov 12, 2024 · 5 comments · Fixed by #47
Closed

Support for 32-bit architectures? #46

jas4711 opened this issue Nov 12, 2024 · 5 comments · Fixed by #47

Comments

@jas4711
Copy link

jas4711 commented Nov 12, 2024

Hi. I'm packaging this for Debian (because the Tillitis TKEY has it as a dependency) and ran into a self test failure on i386:

https://salsa.debian.org/jas/golang-github-ccoveille-go-safecast/-/jobs/6578765

# github.com/ccoveille/go-safecast_test [github.com/ccoveille/go-safecast.test]
src/github.com/ccoveille/go-safecast/conversion_test.go:732:43: cannot use math.MaxInt32 + 1 (untyped int constant 2147483648) as int value in struct literal (overflows)
src/github.com/ccoveille/go-safecast/conversion_test.go:733:43: cannot use math.MinInt32 - 1 (untyped int constant -2147483649) as int value in struct literal (overflows)
src/github.com/ccoveille/go-safecast/conversion_test.go:886:43: cannot use math.MaxUint32 + 1 (untyped int constant 4294967296) as int value in struct literal (overflows)
src/github.com/ccoveille/go-safecast/conversion_test.go:943:43: cannot use math.MaxUint32 + 1 (untyped int constant 4294967296) as uint value in struct literal (overflows)
src/github.com/ccoveille/go-safecast/conversion_test.go:1083:43: cannot use math.MaxInt64 + 1 (untyped int constant 9223372036854775808) as uint value in struct literal (overflows)
src/github.com/ccoveille/go-safecast/conversion_test.go:1375:43: cannot use math.MaxInt64 + 1 (untyped int constant 9223372036854775808) as uint value in struct literal (overflows)
FAIL	github.com/ccoveille/go-safecast [build failed]

Could you fix this, so the package works on 32-bit platforms too? Or is this package only for 64-bit architectures?

/Simon

@ccoVeille
Copy link
Owner

ccoVeille commented Nov 12, 2024

Hi

I initially planned to support it.

Thanks for reminding me I should work on this.

It's a duplicate of

@jas4711
Copy link
Author

jas4711 commented Nov 12, 2024

Thank you! Closing to avoid duplicates.

@jas4711 jas4711 closed this as completed Nov 12, 2024
@ccoVeille
Copy link
Owner

because the Tillitis TKEY has it as a dependency

For reference, is it the project you are talking about?

https://github.com/tillitis/tkeyclient

@jas4711
Copy link
Author

jas4711 commented Nov 12, 2024

because the Tillitis TKEY has it as a dependency

For reference, is it the project you are talking about?

https://github.com/tillitis/tkeyclient

Yes! I am packaging that for Debian now too.

/Simon

ccoVeille added a commit that referenced this issue Nov 13, 2024
ccoVeille added a commit that referenced this issue Nov 13, 2024
ccoVeille added a commit that referenced this issue Nov 13, 2024
ccoVeille added a commit that referenced this issue Nov 13, 2024
Fixes #6
Fixes #46

The tests in conversion_test.go are the ones that are not architecture dependent
The tests in conversion_64bit_test.go complete them for 64-bit systems

The tests in examples_test.go are the ones that are not architecture dependent
The tests in examples_32bit_test.go are for 32-bit systems
The tests in examples_64bit_test.go are for 64-bit systems

The architecture dependent file covers the fact, you can reach a higher value with int and uint
on 64-bit systems, but you will get a compile error on 32-bit.

The error message is different on 32-bit and 64-bit systems
The max is 9223372036854775807 on 64-bit and 2147483647 on 32-bit
ccoVeille added a commit that referenced this issue Nov 14, 2024
Fixes #6
Fixes #46

The tests in conversion_test.go are the ones that are not architecture dependent
The tests in conversion_64bit_test.go complete them for 64-bit systems

The tests in examples_test.go are the ones that are not architecture dependent
The tests in examples_32bit_test.go are for 32-bit systems
The tests in examples_64bit_test.go are for 64-bit systems

The architecture dependent file covers the fact, you can reach a higher value with int and uint
on 64-bit systems, but you will get a compile error on 32-bit.

The error message is different on 32-bit and 64-bit systems
The max is 9223372036854775807 on 64-bit and 2147483647 on 32-bit
ccoVeille added a commit that referenced this issue Nov 15, 2024
Fixes #6
Fixes #46

The tests in conversion_test.go are the ones that are not architecture dependent
The tests in conversion_64bit_test.go complete them for 64-bit systems

The tests in examples_test.go are the ones that are not architecture dependent
The tests in examples_32bit_test.go are for 32-bit systems
The tests in examples_64bit_test.go are for 64-bit systems

The architecture dependent file covers the fact, you can reach a higher value with int and uint
on 64-bit systems, but you will get a compile error on 32-bit.

The error message is different on 32-bit and 64-bit systems
The max is 9223372036854775807 on 64-bit and 2147483647 on 32-bit
@ccoVeille
Copy link
Owner

Fixed with

Confirmation #47 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants