Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Inglis2004-10-01 14:47:09 +0000
committerDavid Inglis2004-10-01 14:47:09 +0000
commit23d71189d55a741eb0ae91e18259ec7cf1cf86ab (patch)
treef9ebe057239357e1bbc5c07b09c41ea99515cde7
parent0ab0b97b0f14ed3899fa12ea87c82d012fd5f466 (diff)
downloadorg.eclipse.cdt-23d71189d55a741eb0ae91e18259ec7cf1cf86ab.tar.gz
org.eclipse.cdt-23d71189d55a741eb0ae91e18259ec7cf1cf86ab.tar.xz
org.eclipse.cdt-23d71189d55a741eb0ae91e18259ec7cf1cf86ab.zip
added getSize()
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java8
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32.java10
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64.java10
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;
+ }
}

Back to the top