Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5038535

Efficiency of SPARC code generated for byte to long conversion

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 1.4.2
    • hotspot
    • b56
    • sparc
    • solaris_9

      Please look into optimizing the code generated for the method getLong()
      in the following:

      public class Optimize {

          private byte[] buffer = new byte[] {1, 0, 0, 0, 0, 0, 0, 0};

          public static void main(String[] args) {
              Optimize opt = new Optimize();
              long l = 0L;
              for (int i = 0; i < 1000000000; i++) {
                  l += opt.getLong(i & 7);
              }
              System.out.println("l = " + l);
          }

          public Optimize() {}

          public long getLong(int i) {
              long b = buffer[i] & 0xFFL;
              return b << 32;
          }
      }

            azeemj Azeem Jiva
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: