hannesw@2090: /* hannesw@2090: * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. hannesw@2090: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. hannesw@2090: * hannesw@2090: * This code is free software; you can redistribute it and/or modify it hannesw@2090: * under the terms of the GNU General Public License version 2 only, as hannesw@2090: * published by the Free Software Foundation. hannesw@2090: * hannesw@2090: * This code is distributed in the hope that it will be useful, but WITHOUT hannesw@2090: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or hannesw@2090: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License hannesw@2090: * version 2 for more details (a copy is included in the LICENSE file that hannesw@2090: * accompanied this code). hannesw@2090: * hannesw@2090: * You should have received a copy of the GNU General Public License version hannesw@2090: * 2 along with this work; if not, write to the Free Software Foundation, hannesw@2090: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. hannesw@2090: * hannesw@2090: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA hannesw@2090: * or visit www.oracle.com if you need additional information or have any hannesw@2090: * questions. hannesw@2090: */ hannesw@2090: hannesw@2090: /** hannesw@2090: * JDK-8181191: getUint32 returning Long hannesw@2090: * hannesw@2090: * @test hannesw@2090: * @run hannesw@2090: */ hannesw@2090: hannesw@2090: hannesw@2090: function uint32(x) { hannesw@2090: var buffer = new ArrayBuffer(16); hannesw@2090: var dataview = new DataView(buffer); hannesw@2090: dataview.setUint32(0, x); hannesw@2090: return dataview.getUint32(0); hannesw@2090: } hannesw@2090: hannesw@2090: Assert.assertTrue(typeof uint32(0x7f) === 'number'); hannesw@2090: Assert.assertTrue(typeof uint32(0x80) === 'number'); hannesw@2090: Assert.assertTrue(typeof uint32(0xffffffff) === 'number'); hannesw@2090: Assert.assertTrue(typeof uint32(0x100000000) === 'number'); hannesw@2090: hannesw@2090: Assert.assertTrue(uint32(0x7f) === 0x7f); hannesw@2090: Assert.assertTrue(uint32(0x80) === 0x80); hannesw@2090: Assert.assertTrue(uint32(0xffffffff) === 0xffffffff); hannesw@2090: Assert.assertTrue(uint32(0x100000000) === 0x0); hannesw@2090: hannesw@2090: Assert.assertTrue(uint32(0x7f) === uint32(0x7f)); hannesw@2090: Assert.assertTrue(uint32(0x80) === uint32(0x80)); hannesw@2090: Assert.assertTrue(uint32(0xffffffff) === uint32(0xffffffff)); hannesw@2090: Assert.assertTrue(uint32(0x100000000) === uint32(0x100000000));