Refactoring state transitioning

This commit is contained in:
obscuren
2014-06-13 12:45:11 +02:00
parent b855e5f7df
commit d078e9b8c9
10 changed files with 517 additions and 199 deletions

View File

@ -111,6 +111,12 @@ func (m *Memory) Set(offset, size int64, value []byte) {
copy(m.store[offset:offset+size], value)
}
func (m *Memory) Resize(size uint64) {
if uint64(m.Len()) < size {
m.store = append(m.store, make([]byte, size-uint64(m.Len()))...)
}
}
func (m *Memory) Get(offset, size int64) []byte {
return m.store[offset : offset+size]
}