ceylon/ceylon.language — pull request #601 by jvasileff (2014-12-11 16:48:39+00:00)
Title: faster primitive narrowing conversions

As discussed on IRC, this change can significantly improve performance for narrowing conversions required for native array access. In one test involving multiplication of two `long[]`s, overall execution time was reduced by 20%.

I'm not sure *why* this change results in faster execution, and in fact, seemingly trivial or unrelated differences in the code that calls `toInt(...)` can dramatically affect the amount of improvement. But in my tests, there was always an improvement of at least a few percent.

I also tried:

```java
public static final long MAX_INT = Integer.MAX_VALUE;
public static final long MIN_INT = Integer.MIN_VALUE;

public static int toInt(long value) {
if (value > MAX_INT || value < MIN_INT) {
throw new OverflowException();
}
return (int)value;
}
```

which resulting in no change at all from the original.