From a2059554c279c102bb30eb8de753a4fa1b217764 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 29 May 2006 12:30:23 +0000 Subject: [PATCH] Split out the exception case in BufferChecks.checkBufferSize() to help the JVM inline it --- src/java/org/lwjgl/BufferChecks.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/java/org/lwjgl/BufferChecks.java b/src/java/org/lwjgl/BufferChecks.java index 6460a6d1..ad5a4ab9 100644 --- a/src/java/org/lwjgl/BufferChecks.java +++ b/src/java/org/lwjgl/BufferChecks.java @@ -177,6 +177,13 @@ public class BufferChecks { } } + /** + * This is a separate call to help inline checkBufferSize. + */ + private static void throwBufferSizeException(Buffer buf, int size) { + throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size); + } + /** * Helper method to ensure a buffer is big enough to receive data from a * glGet* operation. @@ -189,7 +196,7 @@ public class BufferChecks { */ private static void checkBufferSize(Buffer buf, int size) { if (buf.remaining() < size) { - throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size); + throwBufferSizeException(buf, size); } }