# HG changeset patch # User Roland Schatz # Date 1400858497 -7200 # Node ID 70bb8df01b6ed56d9694a30a9cb0e2ce21625143 # Parent 7d1690e145aee586d2d9b96efed01bd043435847 Allow signed values in Buffer.emit(Byte|Short). diff -r 7d1690e145ae -r 70bb8df01b6e graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java --- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java Fri May 23 11:44:18 2014 +0200 +++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java Fri May 23 17:21:37 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2014, 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 @@ -48,7 +48,7 @@ /** * Closes this buffer. No extra data can be written to this buffer after this call. - * + * * @param trimmedCopy if {@code true}, then a copy of the underlying byte array up to (but not * including) {@code position()} is returned * @return the data in this buffer or a trimmed copy if {@code trimmedCopy} is {@code true} @@ -68,7 +68,7 @@ /** * Copies the data from this buffer into a given array. - * + * * @param dst the destination array * @param off starting position in {@code dst} * @param len number of bytes to copy @@ -114,7 +114,7 @@ } public int emitByte(int b, int pos) { - assert NumUtil.isUByte(b); + assert NumUtil.isUByte(b) || NumUtil.isByte(b); int newPos = pos + 1; ensureSize(newPos); data[pos] = (byte) (b & 0xFF); @@ -139,7 +139,7 @@ @Override public int emitShort(int b, int pos) { - assert NumUtil.isUShort(b); + assert NumUtil.isUShort(b) || NumUtil.isShort(b); int newPos = pos + 2; ensureSize(pos + 2); data[pos] = (byte) ((b >> 8) & 0xFF); @@ -188,7 +188,7 @@ @Override public int emitShort(int b, int pos) { - assert NumUtil.isUShort(b); + assert NumUtil.isUShort(b) || NumUtil.isShort(b); int newPos = pos + 2; ensureSize(newPos); data[pos] = (byte) (b & 0xFF);