1 | static Bits joinBits(Collection<Bits> l) { |
2 | if (empty(l)) ret new Bits; |
3 | new Bits bits; |
4 | for (Bits b : l) |
5 | appendBits(bits, b); |
6 | ret bits; |
7 | } |
8 | |
9 | static Bits joinBits(Bits a, Bits b) { |
10 | if (a == null) ret b; |
11 | if (b == null) ret a; |
12 | int n = a.n; |
13 | BitSet bs = b.bs; |
14 | Bits c = new Bits(cloneBitSet(a.bs), n+b.n); |
15 | BitSet bs2 = c.bs; |
16 | for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) |
17 | bs2.set(n+i); |
18 | ret c; |
19 | } |
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: | #1006145 |
Snippet name: | joinBits |
Eternal ID of this version: | #1006145/1 |
Text MD5: | 0b7921c63bd594a32d4f3eafa960a709 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-21 16:52:01 |
Source code size: | 450 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 523 / 552 |
Referenced in: | [show references] |