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

16
LINES

< > BotCompany Repo | #1035294 // sqrUbyte

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (49L) is out of date.

1  
scope sqrUbyte
2  
3  
static final short[] #table = makeTable();
4  
5  
static int sqrUbyte(int ubyte) {
6  
  if ((ubyte & ~0xFF) != 0)
7  
    fail("bad ubyte: " + ubyte);
8  
  ret unsignedShortToInt(#table[ubyte]);
9  
}
10  
11  
static short[] #makeTable() {
12  
  short[] tbl = new[256];
13  
  for i to 256:
14  
    tbl[i] = (short) (i*i);
15  
  ret tbl;
16  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035294
Snippet name: sqrUbyte
Eternal ID of this version: #1035294/3
Text MD5: 2bc8848b8bd62067090c2624d989a1f0
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-29 03:08:00
Source code size: 325 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 122 / 170
Version history: 2 change(s)
Referenced in: [show references]