Split out the exception case in BufferChecks.checkBufferSize() to help the JVM inline it

This commit is contained in:
Elias Naur 2006-05-29 12:30:23 +00:00
parent 5e4807ebac
commit a2059554c2
1 changed files with 8 additions and 1 deletions

View File

@ -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);
}
}