Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

7
LINES

< > BotCompany Repo | #1016701 // clipShort - clip int/double to range of short

JavaX fragment (include)

static short clipShort(int i) {
  ret (short) max(-32768, min(32767, i));
}

static short clipShort(double d) {
  ret (short) iround(max(-32768, min(32767, d));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1016701
Snippet name: clipShort - clip int/double to range of short
Eternal ID of this version: #1016701/3
Text MD5: 0be04e753d4ad9951ef9b95acd272a6d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-28 15:10:34
Source code size: 168 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 284 / 323
Version history: 2 change(s)
Referenced in: [show references]