Commit 6a7c1fdb authored by Edoardo Putti's avatar Edoardo Putti Committed by Mart Lubbers

use fill instead of iteration when zeroing memory

parent 3b69b008
......@@ -8,34 +8,30 @@
package nl.uu.cs.ssm ;
import java.util.Arrays;
import java.util.Hashtable;
public class Memory extends AbstractMemoryCellModel
public class Memory
extends AbstractMemoryCellModel
implements MemoryCellModel
{
private int cells[] ;
private Hashtable<Integer,MemoryAnnotation> annotations ;
private int nUsedForCode ;
private int cells[];
private Hashtable<Integer,MemoryAnnotation> annotations;
private int nUsedForCode ;
private Messenger messenger ;
private Messenger messenger;
protected Memory( int initCapacity, Messenger m )
{
cells = new int[ initCapacity ] ;
for ( int i = 0 ; i < cells.length ; i++ )
cells[ i ] = 0 ;
protected Memory(int initCapacity, Messenger m) {
cells = new int[initCapacity] ;
Arrays.fill(cells, 0);
messenger = m ;
reset() ;
}
public void reset()
{
public void reset() {
nUsedForCode = 0 ;
annotations = new Hashtable<Integer,MemoryAnnotation>() ;
for ( int i = 0 ; i < cells.length ; i++ )
setAt( i, 0 ) ;
Arrays.fill(cells, 0);
}
public int getCapacity()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment