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

les: rework arm64's undefined workaround #21994

Merged
merged 1 commit into from
Dec 11, 2020

Conversation

gballet
Copy link
Member

@gballet gballet commented Dec 10, 2020

The previous fix #21960 converted the float to an intermediate signed int, before attempting the uint conversion. Although this works, this doesn't guarantee that other architectures will work the same.

@@ -86,11 +86,15 @@ func (e *ExpiredValue) Add(amount int64, logOffset Fixed64) int64 {
e.Exp = integer
}
if base >= 0 || uint64(-base) <= e.Base {
Copy link
Contributor

@holiman holiman Dec 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simpler:

	if base >= 0{
		e.Base += uint64(base)
	}else if uint64(-base) <= e.base{
		// The conversion from negative float64 to
		// uint64 is undefined in golang, and doesn't
		// work with ARMv8. More details at:
		// https://github.com/golang/go/issues/43047
		e.Base -= uint64(-base)
	}
	return amount

... ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nevermind...

@holiman holiman added this to the 1.10.0 milestone Dec 11, 2020
@holiman holiman merged commit 1a715d7 into ethereum:master Dec 11, 2020
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 this pull request may close these issues.

2 participants