diff options
3 files changed, 22 insertions, 6 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java index 8dd0d099cfe..d18db625cab 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java @@ -106,8 +106,16 @@ public interface IAddress extends Comparable /** * Returns amount of symbols in hex representation. Is identical to * toHexAddressString().length(). It is present for perfomance purpose. + * * @return the nmber os chararcter symbols to represent this address in hex. */ int getCharsNum(); + /** + * Returns the address size in bytes. + * + * @return the number of bytes required to hold this address. + */ + int getSize(); + } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32.java index 7316a22244e..de5f5880633 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32.java @@ -21,9 +21,9 @@ public class Addr32 implements IAddress { public static final BigInteger MAX_OFFSET = BigInteger.valueOf(MAX_ADDR); - public static final int BYTES_NUM = 4; - public static final int DIGITS_NUM = BYTES_NUM * 2; - public static final int CHARS_NUM = DIGITS_NUM + 2; + private static final int BYTES_NUM = 4; + private static final int DIGITS_NUM = BYTES_NUM * 2; + private static final int CHARS_NUM = DIGITS_NUM + 2; private final long address; @@ -132,4 +132,8 @@ public class Addr32 implements IAddress { public int getCharsNum() { return CHARS_NUM; } + + public int getSize() { + return BYTES_NUM; + } }
\ No newline at end of file diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64.java index 408a9892285..f3018b5af43 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64.java @@ -19,9 +19,9 @@ public class Addr64 implements IAddress { public static final BigInteger MAX_OFFSET = new BigInteger("ffffffffffffffff", 16); //$NON-NLS-1$ - public static final int BYTES_NUM = 8; - public static final int DIGITS_NUM = BYTES_NUM * 2; - public static final int CHARS_NUM = DIGITS_NUM + 2; + private static final int BYTES_NUM = 8; + private static final int DIGITS_NUM = BYTES_NUM * 2; + private static final int CHARS_NUM = DIGITS_NUM + 2; private final BigInteger address; @@ -127,5 +127,9 @@ public class Addr64 implements IAddress { public int getCharsNum() { return CHARS_NUM; } + + public int getSize() { + return BYTES_NUM; + } } |