From: Fabian Stemmler Date: Mon, 26 Aug 2019 11:09:58 +0000 (+0200) Subject: Added size() in MainMemoryDefinition X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=ad98b3b6d2de025c72ab9018e6756eec69d98283;p=Mograsim.git Added size() in MainMemoryDefinition --- 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(); + } }