Returns the Starlark int value that represents x.
(int x)
| 53 | |
| 54 | /** Returns the Starlark int value that represents x. */ |
| 55 | public static StarlarkInt of(int x) { |
| 56 | int index = x - LEAST_SMALLINT; // (may overflow) |
| 57 | if (0 <= index && index < smallints.length) { |
| 58 | Int32 xi = smallints[index]; |
| 59 | if (xi == null) { |
| 60 | xi = new Int32(x); |
| 61 | smallints[index] = xi; |
| 62 | } |
| 63 | return xi; |
| 64 | } |
| 65 | return new Int32(x); |
| 66 | } |
| 67 | |
| 68 | /** Returns the Starlark int value that represents x. */ |
| 69 | public static StarlarkInt of(long x) { |