Rename fpu to asm package
This commit is contained in:
parent
bbd84ccde0
commit
252d9ed9d3
|
@ -8,4 +8,4 @@ This package implements RandomX without CGO, using only Golang code, pure float6
|
|||
|
||||
All test cases pass properly.
|
||||
|
||||
Supports `386` `amd64` `arm64` platforms due to rounding mode set via assembly. More can be added with supporting rounding mode under _fpu_.
|
||||
Supports `386` `amd64` `arm64` platforms due to rounding mode set via assembly. More can be added with supporting rounding mode under _asm_.
|
|
@ -1,4 +1,4 @@
|
|||
package fpu
|
||||
package asm
|
||||
|
||||
type RoundingMode uint8
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
//go:build 386
|
||||
|
||||
package fpu
|
||||
package asm
|
||||
|
||||
// stmxcsr reads the MXCSR control and status register.
|
||||
//
|
|
@ -1,6 +1,6 @@
|
|||
//go:build amd64
|
||||
|
||||
package fpu
|
||||
package asm
|
||||
|
||||
// stmxcsr reads the MXCSR control and status register.
|
||||
//
|
|
@ -1,6 +1,6 @@
|
|||
//go:build arm64
|
||||
|
||||
package fpu
|
||||
package asm
|
||||
|
||||
// GetFPCR returns the value of FPCR register.
|
||||
func getFPCR() (value uint32)
|
|
@ -1,6 +1,6 @@
|
|||
//go:build !arm64 && !amd64 && !386
|
||||
|
||||
package fpu
|
||||
package asm
|
||||
|
||||
func setRoundingMode(mode uint8) {
|
||||
panic("not implemented")
|
8
vm.go
8
vm.go
|
@ -30,7 +30,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
package randomx
|
||||
|
||||
import (
|
||||
"git.gammaspectra.live/P2Pool/go-randomx/fpu"
|
||||
"git.gammaspectra.live/P2Pool/go-randomx/asm"
|
||||
"math"
|
||||
"runtime"
|
||||
)
|
||||
|
@ -60,6 +60,8 @@ type VM struct {
|
|||
config Config // configuration
|
||||
datasetOffset uint64
|
||||
|
||||
Dataset Randomx_Dataset
|
||||
|
||||
Cache *Randomx_Cache // randomx cache
|
||||
|
||||
}
|
||||
|
@ -231,10 +233,10 @@ func (vm *VM) CalculateHash(input []byte, output []byte) {
|
|||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
//restore rounding mode to golang expected one
|
||||
defer fpu.SetRoundingMode(fpu.RoundingModeToNearest)
|
||||
defer asm.SetRoundingMode(asm.RoundingModeToNearest)
|
||||
|
||||
// reset rounding mode if new hash being calculated
|
||||
fpu.SetRoundingMode(fpu.RoundingModeToNearest)
|
||||
asm.SetRoundingMode(asm.RoundingModeToNearest)
|
||||
|
||||
input_hash := blake2b.Sum512(input)
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ package randomx
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"git.gammaspectra.live/P2Pool/go-randomx/fpu"
|
||||
"git.gammaspectra.live/P2Pool/go-randomx/asm"
|
||||
)
|
||||
import "math"
|
||||
import "math/bits"
|
||||
|
@ -714,7 +714,7 @@ func (vm *VM) InterpretByteCode() {
|
|||
case VM_CFROUND:
|
||||
|
||||
tmp := (bits.RotateLeft64(*ibc.isrc, 0-int(ibc.imm))) % 4 // rotate right
|
||||
fpu.SetRoundingMode(fpu.RoundingMode(tmp))
|
||||
asm.SetRoundingMode(asm.RoundingMode(tmp))
|
||||
|
||||
//panic("round not implemented")
|
||||
//panic("VM_CFROUND")
|
||||
|
|
Loading…
Reference in a new issue