diff graal/com.oracle.max.cri/src/com/sun/cri/ci/CiBitMap.java @ 4142:bc8527f3071c

Adjust code base to new level of warnings.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 18 Dec 2011 05:24:06 +0100
parents e233f5660da4
children f5328dda9714
line wrap: on
line diff
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiBitMap.java	Sun Dec 18 05:23:52 2011 +0100
+++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiBitMap.java	Sun Dec 18 05:24:06 2011 +0100
@@ -30,6 +30,7 @@
  */
 public final class CiBitMap implements Serializable {
 
+    private static final long serialVersionUID = 2471441272241401105L;
     private static final int ADDRESS_BITS_PER_WORD = 6;
     private static final int BITS_PER_WORD = 1 << ADDRESS_BITS_PER_WORD;
     private static final int BIT_INDEX_MASK = BITS_PER_WORD - 1;
@@ -160,11 +161,11 @@
         }
     }
 
-    private int bitInWord(int i) {
+    private static int bitInWord(int i) {
         return i & BIT_INDEX_MASK;
     }
 
-    private int wordIndex(int i) {
+    private static int wordIndex(int i) {
         return (i >> ADDRESS_BITS_PER_WORD) - 1;
     }
 
@@ -424,7 +425,7 @@
         return -1;
     }
 
-    private int bitIndex(int index) {
+    private static int bitIndex(int index) {
         return (index + 1) << ADDRESS_BITS_PER_WORD;
     }
 
@@ -563,10 +564,8 @@
      * @param length the number of bits represented in the returned string. If {@code length < 0 || length > size()},
      *            then the value of {@link #length()} is used.
      */
-    public String toBinaryString(int length) {
-        if (length < 0 || length > size) {
-            length = length();
-        }
+    public String toBinaryString() {
+        int length = length();
         if (length == 0) {
             return "";
         }
@@ -589,9 +588,9 @@
         if (size == 0) {
             return "";
         }
-        int size = CiUtil.align(this.size, 4);
-        StringBuilder sb = new StringBuilder(size / 4);
-        for (int i = 0; i < size; i += 4) {
+        int hexSize = CiUtil.align(this.size, 4);
+        StringBuilder sb = new StringBuilder(hexSize / 4);
+        for (int i = 0; i < hexSize; i += 4) {
             int nibble = get(i) ? 1 : 0;
             if (get(i + 1)) {
                 nibble |= 2;
@@ -629,9 +628,6 @@
      * @return the number of bytes written to {@code arr}
      */
     public int copyTo(byte[] arr, int off, int numberOfBytes) {
-        if (numberOfBytes < 0) {
-            numberOfBytes = (size + 7) / 8;
-        }
         for (int i = 0; i < numberOfBytes; ++i) {
             long word = low;
             int byteInWord;