Libraryless. Click here for Pure Java version (2100L/13K).
1 | static short toShort(O o) {
|
2 | if (o == null) ret (short) 0; |
3 | if (o instanceof Number) |
4 | ret ((Number) o).shortValue(); |
5 | if (o instanceof S) |
6 | ret toShort(parseLong((S) o)); |
7 | throw fail("not convertible to short: " + getClassName(o));
|
8 | } |
9 | |
10 | static short toShort(long l) {
|
11 | if (l != (short) l) fail("Too large for short: " + l);
|
12 | ret (short) l; |
13 | } |
Began life as a copy of #1002621
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1025075 |
| Snippet name: | toShort |
| Eternal ID of this version: | #1025075/2 |
| Text MD5: | 92807323225b47c54c5f02226ce43e13 |
| Transpilation MD5: | cdcc1ee0ffc43216266390f7226c4382 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-09-05 12:29:22 |
| Source code size: | 362 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 472 / 605 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |