Implemented array storage

This commit is contained in:
2024-07-20 17:35:26 +02:00
parent d35c07ed1c
commit 155df7c44c
17 changed files with 150 additions and 45 deletions

View File

@ -12,7 +12,7 @@ func TestStoreNumber(t *testing.T) {
usagePatterns := []struct {
Register cpu.Register
Offset byte
NumBytes byte
Length byte
Number int
Code []byte
}{
@ -150,8 +150,8 @@ func TestStoreNumber(t *testing.T) {
}
for _, pattern := range usagePatterns {
t.Logf("store %dB [%s+%d], %d", pattern.NumBytes, pattern.Register, pattern.Offset, pattern.Number)
code := x64.StoreNumber(nil, pattern.Register, pattern.Offset, pattern.NumBytes, pattern.Number)
t.Logf("store %dB [%s+%d], %d", pattern.Length, pattern.Register, pattern.Offset, pattern.Number)
code := x64.StoreNumber(nil, pattern.Register, pattern.Offset, pattern.Length, pattern.Number)
assert.DeepEqual(t, code, pattern.Code)
}
}
@ -160,7 +160,7 @@ func TestStoreRegister(t *testing.T) {
usagePatterns := []struct {
RegisterTo cpu.Register
Offset byte
NumBytes byte
Length byte
RegisterFrom cpu.Register
Code []byte
}{
@ -298,8 +298,8 @@ func TestStoreRegister(t *testing.T) {
}
for _, pattern := range usagePatterns {
t.Logf("store %dB [%s+%d], %s", pattern.NumBytes, pattern.RegisterTo, pattern.Offset, pattern.RegisterFrom)
code := x64.StoreRegister(nil, pattern.RegisterTo, pattern.Offset, pattern.NumBytes, pattern.RegisterFrom)
t.Logf("store %dB [%s+%d], %s", pattern.Length, pattern.RegisterTo, pattern.Offset, pattern.RegisterFrom)
code := x64.StoreRegister(nil, pattern.RegisterTo, pattern.Offset, pattern.Length, pattern.RegisterFrom)
assert.DeepEqual(t, code, pattern.Code)
}
}