2024-04-11 14:04:59 +00:00
|
|
|
package randomx
|
|
|
|
|
2024-04-17 07:53:24 +00:00
|
|
|
import "unsafe"
|
|
|
|
|
2024-04-14 13:43:54 +00:00
|
|
|
const RegistersCount = 8
|
|
|
|
const RegistersCountFloat = 4
|
|
|
|
|
2024-04-15 00:00:44 +00:00
|
|
|
const LOW = 0
|
|
|
|
const HIGH = 1
|
|
|
|
|
2024-04-14 13:43:54 +00:00
|
|
|
type RegisterLine [RegistersCount]uint64
|
|
|
|
|
|
|
|
type RegisterFile struct {
|
2024-04-15 01:05:21 +00:00
|
|
|
R RegisterLine
|
|
|
|
F [RegistersCountFloat][2]float64
|
|
|
|
E [RegistersCountFloat][2]float64
|
|
|
|
A [RegistersCountFloat][2]float64
|
|
|
|
|
2024-04-17 03:56:05 +00:00
|
|
|
FPRC uint8
|
2024-04-14 13:43:54 +00:00
|
|
|
}
|
|
|
|
|
2024-04-17 07:53:24 +00:00
|
|
|
const RegisterFileSize = RegistersCount*8 + RegistersCountFloat*2*8*3
|
|
|
|
|
|
|
|
func (rf *RegisterFile) Memory() *[RegisterFileSize]byte {
|
|
|
|
return (*[RegisterFileSize]byte)(unsafe.Pointer(rf))
|
|
|
|
}
|
2024-05-01 14:58:49 +00:00
|
|
|
func (rf *RegisterFile) Clear() {
|
|
|
|
clear(rf.Memory()[:])
|
|
|
|
}
|