Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions les/utils/expiredvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...

// This is a temporary fix to circumvent a golang
// uint conversion issue on arm64, which needs to
// be investigated further. More details at:
// 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(int64(base))
if base >= 0 {
e.Base += uint64(base)
} else {
e.Base -= uint64(-base)
}
return amount
}
net := int64(-float64(e.Base) / factor)
Expand Down