Include copy of fmath with fix for archs other than amd64 #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Imported package github.com/barnex/fmath does not compile on other architectures than amd64:
fmath package provides float32 wrappers for standard math package float64 functions. It as (only) one optimization in assembly code for sqrt function, for architecture amd64. This optimization is implemented in two files:
sqrtf_amd64.s
andsqrtf_decl.go
. That later file must be compiled only for amd64 arch because its function body is empty and implemented insqrtf_amd64.s
. Currently it is included in builds for all archs, leading to the error reported above. To fix that, it should be renamed or include a build flag:This pull request proposes to include (copy) fmath package code from github.com/barnex/fmath into go3d, and remove the dependency to github.com/barnex/fmath. One could argue that github.com/barnex/fmath could be fixed instead, but that project shows no activity since 6 years. In addition, it is very simply made of generated wrapper code from a simple bash script (see
codegen.bash
). The only optimisation is within sqrtf function, that works only for amd64.Hence a pragmatic approach is to embed the fixed fmath functions into go3d (just my humble opinion).