math: fix math.Max and math.Min
The math package failed the package tests on arm64 and wasm: GOARCH=arm64 tinygo test math Apparently the builtins llvm.maximum.f64 and llvm.minimum.f64 have slightly different behavior on arm64 and wasm compared to what Go expects.
Этот коммит содержится в:
родитель
d05103668f
коммит
6c1301688b
1 изменённых файлов: 2 добавлений и 18 удалений
|
@ -168,29 +168,13 @@ func math_Log2(x float64) float64 { return math_log2(x) }
|
|||
func math_log2(x float64) float64
|
||||
|
||||
//go:linkname math_Max math.Max
|
||||
func math_Max(x, y float64) float64 {
|
||||
if GOARCH == "arm64" || GOARCH == "wasm" {
|
||||
return llvm_maximum(x, y)
|
||||
}
|
||||
return math_max(x, y)
|
||||
}
|
||||
|
||||
//export llvm.maximum.f64
|
||||
func llvm_maximum(x, y float64) float64
|
||||
func math_Max(x, y float64) float64 { return math_max(x, y) }
|
||||
|
||||
//go:linkname math_max math.max
|
||||
func math_max(x, y float64) float64
|
||||
|
||||
//go:linkname math_Min math.Min
|
||||
func math_Min(x, y float64) float64 {
|
||||
if GOARCH == "arm64" || GOARCH == "wasm" {
|
||||
return llvm_minimum(x, y)
|
||||
}
|
||||
return math_min(x, y)
|
||||
}
|
||||
|
||||
//export llvm.minimum.f64
|
||||
func llvm_minimum(x, y float64) float64
|
||||
func math_Min(x, y float64) float64 { return math_min(x, y) }
|
||||
|
||||
//go:linkname math_min math.min
|
||||
func math_min(x, y float64) float64
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче