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

6
LINES

< > BotCompany Repo | #1014004 // getBit

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

Libraryless. Click here for Pure Java version (3793L/22K).

sbool getBit(byte[] b, int bit) {
  int idx = bit >> 3;
  if (idx < 0 || idx > l(b)) false;
  byte mask = cast 1 << (bit & 7);
  ret (b[idx] & mask) != 0;
}

Author comment

Began life as a copy of #1014003

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1014004
Snippet name: getBit
Eternal ID of this version: #1014004/4
Text MD5: 7f1883cebc6c24e75027fddbb60c12ef
Transpilation MD5: 1a1d660fd2575db1ab7ade84ce033618
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-23 09:02:38
Source code size: 161 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 477 / 498
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)