summaryrefslogtreecommitdiffstats
path: root/libjava/gnu/java/nio/ByteBufferImpl.java
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-19 06:59:23 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-19 06:59:23 +0000
commit507fdaa1f8e9baea793e35976041100056376456 (patch)
tree2bc55e0ef3fca053d995f689e0812505f3e152b2 /libjava/gnu/java/nio/ByteBufferImpl.java
parent3be2f219ac7d91186508ecd1a8791842eefa1764 (diff)
downloadppe42-gcc-507fdaa1f8e9baea793e35976041100056376456.tar.gz
ppe42-gcc-507fdaa1f8e9baea793e35976041100056376456.zip
2003-05-19 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/ByteBufferImpl.java (putLong): Fixed conversion to bytes. (putDouble): Fixed conversion to bytes. * gnu/java/nio/DirectByteBufferImpl.java (putLong): Fixed conversion to bytes. (putDouble): Fixed conversion to bytes. * gnu/java/nio/FileLockImpl.java (isValid): Reformatted. * java/nio/Buffer.java (Buffer): Fixed off-by-one bug in handling mark. * java/nio/ByteBuffer.java: Added newline. * java/nio/CharBuffer.java (toString): Don't use relative get to get string data. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66946 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/java/nio/ByteBufferImpl.java')
-rw-r--r--libjava/gnu/java/nio/ByteBufferImpl.java64
1 files changed, 32 insertions, 32 deletions
diff --git a/libjava/gnu/java/nio/ByteBufferImpl.java b/libjava/gnu/java/nio/ByteBufferImpl.java
index cc7fabb5941..f9de8c7d152 100644
--- a/libjava/gnu/java/nio/ByteBufferImpl.java
+++ b/libjava/gnu/java/nio/ByteBufferImpl.java
@@ -311,14 +311,14 @@ public final class ByteBufferImpl extends ByteBuffer
final public ByteBuffer putLong (long value)
{
// FIXME: this handles big endian only
- put ((byte) ((((int) value) & 0xff00000000000000) >> 56));
- put ((byte) ((((int) value) & 0x00ff000000000000) >> 48));
- put ((byte) ((((int) value) & 0x0000ff0000000000) >> 40));
- put ((byte) ((((int) value) & 0x000000ff00000000) >> 32));
- put ((byte) ((((int) value) & 0x00000000ff000000) >> 24));
- put ((byte) ((((int) value) & 0x0000000000ff0000) >> 16));
- put ((byte) ((((int) value) & 0x000000000000ff00) >> 8));
- put ((byte) (((int) value) & 0x00000000000000ff));
+ put ((byte) ((value & 0xff00000000000000L) >> 56));
+ put ((byte) ((value & 0x00ff000000000000L) >> 48));
+ put ((byte) ((value & 0x0000ff0000000000L) >> 40));
+ put ((byte) ((value & 0x000000ff00000000L) >> 32));
+ put ((byte) ((value & 0x00000000ff000000L) >> 24));
+ put ((byte) ((value & 0x0000000000ff0000L) >> 16));
+ put ((byte) ((value & 0x000000000000ff00L) >> 8));
+ put ((byte) (value & 0x00000000000000ffL));
return this;
}
@@ -338,14 +338,14 @@ public final class ByteBufferImpl extends ByteBuffer
final public ByteBuffer putLong (int index, long value)
{
// FIXME: this handles big endian only
- put (index, (byte) ((((int) value) & 0xff00000000000000) >> 56));
- put (index + 1, (byte) ((((int) value) & 0x00ff000000000000) >> 48));
- put (index + 2, (byte) ((((int) value) & 0x0000ff0000000000) >> 40));
- put (index + 3, (byte) ((((int) value) & 0x000000ff00000000) >> 32));
- put (index + 4, (byte) ((((int) value) & 0x00000000ff000000) >> 24));
- put (index + 5, (byte) ((((int) value) & 0x0000000000ff0000) >> 16));
- put (index + 6, (byte) ((((int) value) & 0x000000000000ff00) >> 8));
- put (index + 7, (byte) (((int) value) & 0x00000000000000ff));
+ put (index, (byte) ((value & 0xff00000000000000L) >> 56));
+ put (index + 1, (byte) ((value & 0x00ff000000000000L) >> 48));
+ put (index + 2, (byte) ((value & 0x0000ff0000000000L) >> 40));
+ put (index + 3, (byte) ((value & 0x000000ff00000000L) >> 32));
+ put (index + 4, (byte) ((value & 0x00000000ff000000L) >> 24));
+ put (index + 5, (byte) ((value & 0x0000000000ff0000L) >> 16));
+ put (index + 6, (byte) ((value & 0x000000000000ff00L) >> 8));
+ put (index + 7, (byte) (value & 0x00000000000000ffL));
return this;
}
@@ -403,14 +403,14 @@ public final class ByteBufferImpl extends ByteBuffer
final public ByteBuffer putDouble (double value)
{
// FIXME: this handles big endian only
- put ((byte) ((((int) value) & 0xff00000000000000) >> 56));
- put ((byte) ((((int) value) & 0x00ff000000000000) >> 48));
- put ((byte) ((((int) value) & 0x0000ff0000000000) >> 40));
- put ((byte) ((((int) value) & 0x000000ff00000000) >> 32));
- put ((byte) ((((int) value) & 0x00000000ff000000) >> 24));
- put ((byte) ((((int) value) & 0x0000000000ff0000) >> 16));
- put ((byte) ((((int) value) & 0x000000000000ff00) >> 8));
- put ((byte) (((int) value) & 0x00000000000000ff));
+ put ((byte) ((((long) value) & 0xff00000000000000L) >> 56));
+ put ((byte) ((((long) value) & 0x00ff000000000000L) >> 48));
+ put ((byte) ((((long) value) & 0x0000ff0000000000L) >> 40));
+ put ((byte) ((((long) value) & 0x000000ff00000000L) >> 32));
+ put ((byte) ((((long) value) & 0x00000000ff000000L) >> 24));
+ put ((byte) ((((long) value) & 0x0000000000ff0000L) >> 16));
+ put ((byte) ((((long) value) & 0x000000000000ff00L) >> 8));
+ put ((byte) (((long) value) & 0x00000000000000ffL));
return this;
}
@@ -430,14 +430,14 @@ public final class ByteBufferImpl extends ByteBuffer
final public ByteBuffer putDouble (int index, double value)
{
// FIXME: this handles big endian only
- put (index, (byte) ((((int) value) & 0xff00000000000000) >> 56));
- put (index + 1, (byte) ((((int) value) & 0x00ff000000000000) >> 48));
- put (index + 2, (byte) ((((int) value) & 0x0000ff0000000000) >> 40));
- put (index + 3, (byte) ((((int) value) & 0x000000ff00000000) >> 32));
- put (index + 4, (byte) ((((int) value) & 0x00000000ff000000) >> 24));
- put (index + 5, (byte) ((((int) value) & 0x0000000000ff0000) >> 16));
- put (index + 6, (byte) ((((int) value) & 0x000000000000ff00) >> 8));
- put (index + 7, (byte) (((int) value) & 0x00000000000000ff));
+ put (index, (byte) ((((long) value) & 0xff00000000000000L) >> 56));
+ put (index + 1, (byte) ((((long) value) & 0x00ff000000000000L) >> 48));
+ put (index + 2, (byte) ((((long) value) & 0x0000ff0000000000L) >> 40));
+ put (index + 3, (byte) ((((long) value) & 0x000000ff00000000L) >> 32));
+ put (index + 4, (byte) ((((long) value) & 0x00000000ff000000L) >> 24));
+ put (index + 5, (byte) ((((long) value) & 0x0000000000ff0000L) >> 16));
+ put (index + 6, (byte) ((((long) value) & 0x000000000000ff00L) >> 8));
+ put (index + 7, (byte) (((long) value) & 0x00000000000000ffL));
return this;
}
}
OpenPOWER on IntegriCloud