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.

scope sqrUbyte

static final short[] #table = makeTable();

static int sqrUbyte(int ubyte) {
  if ((ubyte & ~0xFF) != 0)
    fail("bad ubyte: " + ubyte);
  ret unsignedShortToInt(#table[ubyte]);
}

static short[] #makeTable() {
  short[] tbl = new[256];
  for i to 256:
    tbl[i] = (short) (i*i);
  ret tbl;
}

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: 52 / 75
Version history: 2 change(s)
Referenced in: [show references]