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

16
LINES

< > BotCompany Repo | #1014003 // setBit

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

Transpiled version (41L) is out of date.

svoid setBit(BitSet b, int bit) {
  b?.set(bit);
}

svoid setBit(BitSet b, int bit, bool value) {
  b?.set(bit, value);
}

svoid setBit(byte[] b, int bit, bool value default true) {
  int idx = bit >> 3;
  byte mask = cast 1 << (bit & 7);
  if (value)
    b[idx] |= mask;
  else
    b[idx] &= ~mask;
}

Author comment

Began life as a copy of #1005056

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: #1014003
Snippet name: setBit
Eternal ID of this version: #1014003/6
Text MD5: 8a2d9b95edf842d5272c9e44ade297e9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-05 18:40:40
Source code size: 316 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 449 / 562
Version history: 5 change(s)
Referenced in: [show references]