From: Carsten W. <ca...@us...> - 2007-03-19 02:16:05
|
Update of /cvsroot/jake2/jake2/lib/lwjgl/patch/org/lwjgl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3471/lib/lwjgl/patch/org/lwjgl Modified Files: BufferChecks.java Log Message: performance patch; checks removed Index: BufferChecks.java =================================================================== RCS file: /cvsroot/jake2/jake2/lib/lwjgl/patch/org/lwjgl/BufferChecks.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BufferChecks.java 17 Mar 2007 15:59:54 -0000 1.1 --- BufferChecks.java 17 Mar 2007 16:02:17 -0000 1.2 *************** *** 64,70 **** */ public static void checkFunctionAddress(long pointer) { - if (pointer == 0) { - throw new IllegalStateException("Function is not supported"); - } } --- 64,67 ---- *************** *** 73,84 **** */ public static void checkNullTerminated(ByteBuffer buf) { - if (buf.get(buf.limit() - 1) != 0) { - throw new IllegalArgumentException("Missing null termination"); - } } public static void checkNotNull(Object o) { - if (o == null) - throw new IllegalArgumentException("Null argument"); } --- 70,76 ---- *************** *** 87,123 **** */ public static void checkDirectOrNull(ByteBuffer buf) { - if (buf != null) { - checkDirect(buf); - } } public static void checkDirectOrNull(ShortBuffer buf) { - if (buf != null) { - checkDirect(buf); - } } public static void checkDirectOrNull(IntBuffer buf) { - if (buf != null) { - checkDirect(buf); - } } public static void checkDirectOrNull(LongBuffer buf) { - if (buf != null) { - checkDirect(buf); - } } public static void checkDirectOrNull(FloatBuffer buf) { - if (buf != null) { - checkDirect(buf); - } } public static void checkDirectOrNull(DoubleBuffer buf) { - if (buf != null) { - checkDirect(buf); - } } --- 79,97 ---- *************** *** 126,179 **** */ public static void checkDirectBuffer(Buffer buf) { - if (buf instanceof FloatBuffer) - checkDirect((FloatBuffer)buf); - else if (buf instanceof ByteBuffer) - checkDirect((ByteBuffer)buf); - else if (buf instanceof ShortBuffer) - checkDirect((ShortBuffer)buf); - else if (buf instanceof IntBuffer) - checkDirect((IntBuffer)buf); - else if (buf instanceof LongBuffer) - checkDirect((LongBuffer)buf); - else if (buf instanceof DoubleBuffer) - checkDirect((DoubleBuffer)buf); - else - throw new IllegalStateException("Unsupported buffer type"); } public static void checkDirect(ByteBuffer buf) { - if (!buf.isDirect()) { - throw new IllegalArgumentException("ByteBuffer is not direct"); - } } public static void checkDirect(ShortBuffer buf) { - if (!buf.isDirect()) { - throw new IllegalArgumentException("ShortBuffer is not direct"); - } } public static void checkDirect(IntBuffer buf) { - if (!buf.isDirect()) { - throw new IllegalArgumentException("IntBuffer is not direct"); - } } public static void checkDirect(LongBuffer buf) { - if (!buf.isDirect()) { - throw new IllegalArgumentException("LongBuffer is not direct"); - } } public static void checkDirect(FloatBuffer buf) { - if (!buf.isDirect()) { - throw new IllegalArgumentException("FloatBuffer is not direct"); - } } public static void checkDirect(DoubleBuffer buf) { - if (!buf.isDirect()) { - throw new IllegalArgumentException("DoubleBuffer is not direct"); - } } --- 100,121 ---- *************** *** 196,232 **** */ private static void checkBufferSize(Buffer buf, int size) { - if (buf.remaining() < size) { - throwBufferSizeException(buf, size); - } } public static void checkBuffer(ByteBuffer buf, int size) { - checkBufferSize(buf, size); - checkDirect(buf); } public static void checkBuffer(ShortBuffer buf, int size) { - checkBufferSize(buf, size); - checkDirect(buf); } public static void checkBuffer(IntBuffer buf, int size) { - checkBufferSize(buf, size); - checkDirect(buf); } public static void checkBuffer(LongBuffer buf, int size) { - checkBufferSize(buf, size); - checkDirect(buf); } public static void checkBuffer(FloatBuffer buf, int size) { - checkBufferSize(buf, size); - checkDirect(buf); } public static void checkBuffer(DoubleBuffer buf, int size) { - checkBufferSize(buf, size); - checkDirect(buf); } --- 138,159 ---- *************** *** 242,266 **** */ public static void checkBuffer(ByteBuffer buf) { - checkBuffer(buf, DEFAULT_BUFFER_SIZE); } public static void checkBuffer(ShortBuffer buf) { - checkBuffer(buf, DEFAULT_BUFFER_SIZE); } public static void checkBuffer(IntBuffer buf) { - checkBuffer(buf, DEFAULT_BUFFER_SIZE); } public static void checkBuffer(LongBuffer buf) { - checkBuffer(buf, DEFAULT_BUFFER_SIZE); } public static void checkBuffer(FloatBuffer buf) { - checkBuffer(buf, DEFAULT_BUFFER_SIZE); } public static void checkBuffer(DoubleBuffer buf) { - checkBuffer(buf, DEFAULT_BUFFER_SIZE); } } --- 169,187 ---- |