jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
changeset 40195 a13e4945de1d
parent 36933 3e6453e2d833
--- a/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template	Wed Jul 27 13:33:55 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template	Fri Jul 29 10:18:47 2016 +0200
@@ -325,20 +325,20 @@
 
     public CharBuffer asCharBuffer() {
         int size = this.remaining() >> 1;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (CharBuffer)(new ByteBufferAsCharBuffer$RW$B(this,
                                                                -1,
                                                                0,
                                                                size,
                                                                size,
-                                                               off))
+                                                               addr))
                 : (CharBuffer)(new ByteBufferAsCharBuffer$RW$L(this,
                                                                -1,
                                                                0,
                                                                size,
                                                                size,
-                                                               off)));
+                                                               addr)));
     }
 
 
@@ -376,20 +376,20 @@
 
     public ShortBuffer asShortBuffer() {
         int size = this.remaining() >> 1;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (ShortBuffer)(new ByteBufferAsShortBuffer$RW$B(this,
                                                                  -1,
                                                                  0,
                                                                  size,
                                                                  size,
-                                                                 off))
+                                                                 addr))
                 : (ShortBuffer)(new ByteBufferAsShortBuffer$RW$L(this,
                                                                  -1,
                                                                  0,
                                                                  size,
                                                                  size,
-                                                                 off)));
+                                                                 addr)));
     }
 
 
@@ -427,20 +427,20 @@
 
     public IntBuffer asIntBuffer() {
         int size = this.remaining() >> 2;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (IntBuffer)(new ByteBufferAsIntBuffer$RW$B(this,
                                                              -1,
                                                              0,
                                                              size,
                                                              size,
-                                                             off))
+                                                             addr))
                 : (IntBuffer)(new ByteBufferAsIntBuffer$RW$L(this,
                                                              -1,
                                                              0,
                                                              size,
                                                              size,
-                                                             off)));
+                                                             addr)));
     }
 
 
@@ -478,20 +478,20 @@
 
     public LongBuffer asLongBuffer() {
         int size = this.remaining() >> 3;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (LongBuffer)(new ByteBufferAsLongBuffer$RW$B(this,
                                                                -1,
                                                                0,
                                                                size,
                                                                size,
-                                                               off))
+                                                               addr))
                 : (LongBuffer)(new ByteBufferAsLongBuffer$RW$L(this,
                                                                -1,
                                                                0,
                                                                size,
                                                                size,
-                                                               off)));
+                                                               addr)));
     }
 
 
@@ -533,20 +533,20 @@
 
     public FloatBuffer asFloatBuffer() {
         int size = this.remaining() >> 2;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$B(this,
                                                                  -1,
                                                                  0,
                                                                  size,
                                                                  size,
-                                                                 off))
+                                                                 addr))
                 : (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$L(this,
                                                                  -1,
                                                                  0,
                                                                  size,
                                                                  size,
-                                                                 off)));
+                                                                 addr)));
     }
 
 
@@ -588,20 +588,20 @@
 
     public DoubleBuffer asDoubleBuffer() {
         int size = this.remaining() >> 3;
-        int off = offset + position();
+        long addr = address + position();
         return (bigEndian
                 ? (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$B(this,
                                                                    -1,
                                                                    0,
                                                                    size,
                                                                    size,
-                                                                   off))
+                                                                   addr))
                 : (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$L(this,
                                                                    -1,
                                                                    0,
                                                                    size,
                                                                    size,
-                                                                   off)));
+                                                                   addr)));
     }