From ad98b3b6d2de025c72ab9018e6756eec69d98283 Mon Sep 17 00:00:00 2001 From: Fabian Stemmler Date: Mon, 26 Aug 2019 13:09:58 +0200 Subject: [PATCH] Added size() in MainMemoryDefinition --- .../src/net/mograsim/machine/MainMemoryDefinition.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java b/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java index 3128cddd..f01d119d 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java +++ b/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java @@ -42,4 +42,14 @@ public interface MainMemoryDefinition { * @author Christian Femers */ long getMaximalAddress(); + + /** + * The size of the MainMemory as the amount of addressable memory cells. + * + * @return the amount of addressable memory cells + */ + default long size() + { + return getMaximalAddress() - getMinimalAddress(); + } } -- 2.17.1