OpenJDK / aarch32-port / jdk9-arm3264 / hotspot
changeset 12311:1d8d01c86279
7107013: sun.jvm.hotspot.runtime.Bytes.swapLong conversion to long mishandled
Summary: Cast to long to avoid truncation in swapLong()
Reviewed-by: dsamersoff
Contributed-by: Sharath Ballal <sharath.ballal@oracle.com>
author | dsamersoff |
---|---|
date | Wed, 16 Nov 2016 14:11:30 +0300 |
parents | f6c1979096f3 |
children | 4d1cc698c0b6 |
files | src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Bytes.java |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Bytes.java Tue Nov 15 19:39:51 2016 -0500 +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Bytes.java Wed Nov 16 14:11:30 2016 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ if (!swap) return x; - return (swapShort((short) x) << 16) | (swapShort((short) (x >> 16)) & 0xFFFF); + return ((int)swapShort((short) x) << 16) | (swapShort((short) (x >> 16)) & 0xFFFF); } /** Should only swap if the hardware's underlying byte order is @@ -60,6 +60,6 @@ if (!swap) return x; - return (swapInt((int) x) << 32) | (swapInt((int) (x >> 32)) & 0xFFFFFFFF); + return ((long)swapInt((int) x) << 32) | (swapInt((int) (x >> 32)) & 0xFFFFFFFF); } }