mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
added getSize()
This commit is contained in:
parent
0ab0b97b0f
commit
23d71189d5
3 changed files with 22 additions and 6 deletions
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue