Libraryless. Click here for Pure Java version (2100L/13K).
static short toShort(O o) { if (o == null) ret (short) 0; if (o instanceof Number) ret ((Number) o).shortValue(); if (o instanceof S) ret toShort(parseLong((S) o)); throw fail("not convertible to short: " + getClassName(o)); } static short toShort(long l) { if (l != (short) l) fail("Too large for short: " + l); ret (short) l; }
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: | 471 / 604 |
| Version history: | 1 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1035619 - toShort_enforce #1035673 - toByte |