final EWAHCompressedBitmap toEWAHCompressedBitmap() { EWAHCompressedBitmap compressed = new EWAHCompressedBitmap( words.length); int runningEmptyWords = 0; long lastNonEmptyWord = 0; for (long word : words) { if (word == 0) { runningEmptyWords++; continue; } if (lastNonEmptyWord != 0) compressed.addWord(lastNonEmptyWord); if (runningEmptyWords > 0) { compressed.addStreamOfEmptyWords(false, runningEmptyWords); runningEmptyWords = 0; } lastNonEmptyWord = word; } int bitsThatMatter = 64 - Long.numberOfLeadingZeros(lastNonEmptyWord); if (bitsThatMatter > 0) compressed.addWord(lastNonEmptyWord, bitsThatMatter); return compressed; }
static final EWAHCompressedBitmap ones(int sizeInBits) { EWAHCompressedBitmap mask = new EWAHCompressedBitmap(); mask.addStreamOfEmptyWords( true, sizeInBits / EWAHCompressedBitmap.WORD_IN_BITS); int remaining = sizeInBits % EWAHCompressedBitmap.WORD_IN_BITS; if (remaining > 0) mask.addWord((1L << remaining) - 1, remaining); return mask; } }
/** * Adding words directly to the bitmap (for expert use). * * This method adds bits in words of 4*8 bits. It is not to * be confused with the set method which sets individual bits. * * Most users will want the set method. * * Example: if you add word 321 to an empty bitmap, you are have * added (in binary notation) 0b101000001, so you have effectively * called set(0), set(6), set(8) in sequence. * * Since this modifies the bitmap, this method is not thread-safe. * * API change: prior to version 0.8.3, this method was called add. * * @param newData the word */ @Override public void addWord(final long newData) { addWord(newData, WORD_IN_BITS); }
/** * @param newData the word * @param bitsThatMatter the number of significant bits (by default it should * be 64) * @deprecated use addWord() instead. */ @Deprecated public void add(final long newData, final int bitsThatMatter) { addWord(newData, bitsThatMatter); }
/** * @param newData the word * @deprecated use addWord() instead. */ @Deprecated public void add(final long newData) { addWord(newData); }
/** * @param newData the word * @deprecated use addWord() instead. */ @Deprecated public void add(final long newData) { addWord(newData); }
/** * Adding words directly to the bitmap (for expert use). * * This method adds bits in words of 4*8 bits. It is not to * be confused with the set method which sets individual bits. * * Most users will want the set method. * * Example: if you add word 321 to an empty bitmap, you are have * added (in binary notation) 0b101000001, so you have effectively * called set(0), set(6), set(8) in sequence. * * Since this modifies the bitmap, this method is not thread-safe. * * API change: prior to version 0.8.3, this method was called add. * * @param newData the word */ @Override public void addWord(final long newData) { addWord(newData, WORD_IN_BITS); }
/** * @param newData the word * @param bitsThatMatter the number of significant bits (by default it should * be 64) * @deprecated use addWord() instead. */ @Deprecated public void add(final long newData, final int bitsThatMatter) { addWord(newData, bitsThatMatter); }
final EWAHCompressedBitmap toEWAHCompressedBitmap() { EWAHCompressedBitmap compressed = new EWAHCompressedBitmap( words.length); int runningEmptyWords = 0; long lastNonEmptyWord = 0; for (long word : words) { if (word == 0) { runningEmptyWords++; continue; } if (lastNonEmptyWord != 0) compressed.addWord(lastNonEmptyWord); if (runningEmptyWords > 0) { compressed.addStreamOfEmptyWords(false, runningEmptyWords); runningEmptyWords = 0; } lastNonEmptyWord = word; } int bitsThatMatter = 64 - Long.numberOfLeadingZeros(lastNonEmptyWord); if (bitsThatMatter > 0) compressed.addWord(lastNonEmptyWord, bitsThatMatter); return compressed; }
static final EWAHCompressedBitmap ones(int sizeInBits) { EWAHCompressedBitmap mask = new EWAHCompressedBitmap(); mask.addStreamOfEmptyWords( true, sizeInBits / EWAHCompressedBitmap.WORD_IN_BITS); int remaining = sizeInBits % EWAHCompressedBitmap.WORD_IN_BITS; if (remaining > 0) mask.addWord((1L << remaining) - 1, remaining); return mask; } }
@Override public EWAHIterator next() { this.buffer.clear(); long effective = 0; Iterator<IteratingRLW> i = this.ll.iterator(); while (i.hasNext()) { IteratingRLW rlw = i.next(); if (rlw.size() > 0) { int eff = IteratorAggregation.inplacexor(this.hardbitmap, rlw); if (eff > effective) effective = eff; } else i.remove(); } for (int k = 0; k < effective; ++k) this.buffer.addWord(this.hardbitmap[k]); Arrays.fill(this.hardbitmap, 0); return this.buffer.getEWAHIterator(); } }
@Override public EWAHIterator next() { this.buffer.clear(); long effective = 0; Iterator<IteratingRLW> i = this.ll.iterator(); while (i.hasNext()) { IteratingRLW rlw = i.next(); if (rlw.size() > 0) { int eff = IteratorAggregation.inplacexor(this.hardbitmap, rlw); if (eff > effective) effective = eff; } else i.remove(); } for (int k = 0; k < effective; ++k) this.buffer.addWord(this.hardbitmap[k]); Arrays.fill(this.hardbitmap, 0); return this.buffer.getEWAHIterator(); } }
@Override public EWAHIterator next() { this.buffer.clear(); long effective = 0; Iterator<IteratingRLW> i = this.ll.iterator(); while (i.hasNext()) { IteratingRLW rlw = i.next(); if (rlw.size() > 0) { int eff = IteratorAggregation.inplaceor(this.hardBitmap, rlw); if (eff > effective) effective = eff; } else i.remove(); } for (int k = 0; k < effective; ++k) { this.buffer.addWord(this.hardBitmap[k]); } Arrays.fill(this.hardBitmap, 0); return this.buffer.getEWAHIterator(); } }
@Override public EWAHIterator next() { this.buffer.clear(); long effective = 0; Iterator<IteratingRLW> i = this.ll.iterator(); while (i.hasNext()) { IteratingRLW rlw = i.next(); if (rlw.size() > 0) { int eff = IteratorAggregation.inplaceor(this.hardBitmap, rlw); if (eff > effective) effective = eff; } else i.remove(); } for (int k = 0; k < effective; ++k) { this.buffer.addWord(this.hardBitmap[k]); } Arrays.fill(this.hardBitmap, 0); return this.buffer.getEWAHIterator(); } }
if (i.getRunningBit()) { long sw = w | (-1l << shift); answer.addWord(sw); w = -1l >>> (WORD_IN_BITS - shift); } else { answer.addWord(w); w = 0; long neww = i.getLiteralWordAt(k); long sw = w | (neww << shift); answer.addWord(sw); w = neww >>> (WORD_IN_BITS - shift); if(shiftextension) answer.addWord(w); break;
if (i.getRunningBit()) { long sw = w | (-1l << shift); answer.addWord(sw); w = -1l >>> (WORD_IN_BITS - shift); } else { answer.addWord(w); w = 0; long neww = i.getLiteralWordAt(k); long sw = w | (neww << shift); answer.addWord(sw); w = neww >>> (WORD_IN_BITS - shift); if(shiftextension) answer.addWord(w); break;