Applies the little-endian WORD (2 bytes) to the relative offset.
        Arguments:
        - `offset`: The relative offset from the start of the block.
        - `word`: The data to apply.
178750
def pack_word(self, offset, word):
        
        o = self._offset + offset
        return struct.pack_into("<H", self._buf, o, word)
734945
public static void setShort(final byte[] b, final short n, final int offset) {
        b[offset + 0] = (byte) (n >>> 8);
        b[offset + 1] = (byte) (n >>> 0);
    }
225950
def align_after(self, offset):
        
        f = self.reader
        if offset <= 0:  # FIXME what is a negative offset??
            f.seek(0)
            self._block_count = 0
            self._read_header()  # FIXME we can't extimate how big it is...
            return
        sm = self.sync_marker
        sml = len(sm)
        pos = offset
        while pos < self.file_length - sml:
            f.seek(pos)
            data = f.read(self.FORWARD_WINDOW_SIZE)
            sync_offset = data.find(sm)
            if sync_offset > -1:
                f.seek(pos + sync_offset)
                self._block_count = 0
                return
            pos += len(data)
103262
private void appendLiteral(int word)
  {
    // when we have a zero sequence of the maximum lenght (that is,
    // 00.00000.1111111111111111111111111 = 0x01FFFFFF), it could happen
    // that we try to append a zero literal because the result of the given operation must be an
    // empty set. Whitout the following test, we would have increased the
    // counter of the zero sequence, thus obtaining 0x02000000 that
    // represents a sequence with the first bit set!
    if (lastWordIndex == 0 && word == ConciseSetUtils.ALL_ZEROS_LITERAL && words[0] == 0x01FFFFFF) {
      return;
    }

    // first addition
    if (lastWordIndex < 0) {
      words[lastWordIndex = 0] = word;
      return;
    }

    final int lastWord = words[lastWordIndex];
    if (word == ConciseSetUtils.ALL_ZEROS_LITERAL) {
      if (lastWord == ConciseSetUtils.ALL_ZEROS_LITERAL) {
        words[lastWordIndex] = 1;
      } else if (isZeroSequence(lastWord)) {
        words[lastWordIndex]++;
      } else if (!simulateWAH && containsOnlyOneBit(getLiteralBits(lastWord))) {
        words[lastWordIndex] = 1 | ((1 + Integer.numberOfTrailingZeros(lastWord)) << 25);
      } else {
        words[++lastWordIndex] = word;
      }
    } else if (word == ConciseSetUtils.ALL_ONES_LITERAL) {
      if (lastWord == ConciseSetUtils.ALL_ONES_LITERAL) {
        words[lastWordIndex] = ConciseSetUtils.SEQUENCE_BIT | 1;
      } else if (isOneSequence(lastWord)) {
        words[lastWordIndex]++;
      } else if (!simulateWAH && containsOnlyOneBit(~lastWord)) {
        words[lastWordIndex] = ConciseSetUtils.SEQUENCE_BIT | 1 | ((1 + Integer.numberOfTrailingZeros(~lastWord))
                                                                   << 25);
      } else {
        words[++lastWordIndex] = word;
      }
    } else {
      words[++lastWordIndex] = word;
    }
  }
1027639
def writeWord(self, word):
        
        self.data.write(pack(self.endianness + ("H" if not self.signed else "h"), word))
87346
def add_word(self, word):
        
        word = word.lower()

        if not (word.isascii() and word.isalpha()):
            raise ValueError("Invalid character in word '{}'".format(word))

        word = word.encode(encoding="ascii")
        result = cgaddag.gdg_add_word(self.gdg, word)
        if result == 1:
            raise ValueError("Invalid character in word '{}'".format(word))
        elif result == 2:
            raise MemoryError("Out of memory, GADDAG is in an undefined state")
11742
def offset(self, offset):
        
        self.log(u"Applying offset to all fragments...")
        self.log([u"  Offset %.3f", offset])
        for fragment in self.fragments:
            fragment.interval.offset(
                offset=offset,
                allow_negative=False,
                min_begin_value=self.begin,
                max_end_value=self.end
            )
        self.log(u"Applying offset to all fragments... done")
1292698
public static void writeIntegerLittleEndian(byte[] buffer, int offset, int value) {
		buffer[offset++] = (byte)(value & 0xFF);
		buffer[offset++] = (byte)((value >> 8) & 0xFF);
		buffer[offset++] = (byte)((value >> 16) & 0xFF);
		buffer[offset] = (byte)((value >> 24) & 0xFF);
	}
909734
protected int readWord(byte[] data, int offset) {
        int low = data[offset] & 0xff;
        int high = data[offset + 1] & 0xff;
        return high << 8 | low;
    }
1135802
def getWordAtOffset(self, offset):
        
        return datatypes.WORD.parse(utils.ReadData(self.getDataAtOffset(offset, 2)))
811423
def endian_swap_words(source):
    
    assert len(source) % 4 == 0
    words = "I" * (len(source) // 4)
    return struct.pack("<" + words, *struct.unpack(">" + words, source))
64922
def apply_T9(word):
    ''''''
    WORD = word
    index = 0
    offset = 0

    for iu in iu_sequences(WORD):
        if iu.start(1) != index:
            i = iu.start(1) + 1 + offset
            WORD = WORD[:i] + '.' + WORD[i:]
            index = iu.start(1)
            offset += 1

    # split any /iu/ sequence in the final syllable iff the final syllable
    # would receive stress -- to capture extrametricality
    if WORD.count('.') % 2 == 0:
        iu = iu_sequences(WORD, word_final=True)

        if iu:
            i = iu.start(1) + 1
            WORD = WORD[:i] + '.' + WORD[i:]

    RULE = ' T9' if word != WORD else ''

    return WORD, RULE
306280
def word(ctx, text, number, by_spaces=False):
    
    return word_slice(ctx, text, number, conversions.to_integer(number, ctx) + 1, by_spaces)
1225682
private static int getBlockLength(String text, int offset)
   {
      int startIndex = offset;
      boolean finished = false;
      char c;

      while (finished == false)
      {
         c = text.charAt(offset);
         switch (c)
         {
            case '\r':
            case '\n':
            case '}':
            {
               finished = true;
               break;
            }

            default:
            {
               ++offset;
               break;
            }
         }
      }

      int length = offset - startIndex;

      return (length);
   }
1361332
def apply_offset(self):
    ''''''
    self._ensure_modification_is_safe()

    if self.query.offset != 0:
      self._iterable = \
        offset_gen(self.query.offset, self._iterable, self._skipped_inc)
411086
def apply_T8(word):
    ''''''
    WORD = word
    offset = 0

    for vv in tail_diphthongs(WORD):
        i = vv.start(1) + 1 + offset
        WORD = WORD[:i] + '.' + WORD[i:]
        offset += 1

    RULE = ' T8' if word != WORD else ''

    return WORD, RULE
1193592
@Override
    public void writeWord(final long word) {
        if(wordsWritten == wordCount) {
            throw new RuntimeException("Cannot write more words, backing array full!");
        }

        int bitsLeftInWord = wordLength;

        while(bitsLeftInWord > 0) {
            // Move to the next byte if the current one is fully packed.
            if(bitsLeftInByte == 0) {
                byteIndex++;
                bitsLeftInByte = BITS_PER_BYTE;
            }

            final long consumedMask;
            if(bitsLeftInWord == 64) {
                consumedMask = ~0L;
            } else {
                consumedMask = ((1L << bitsLeftInWord) - 1L);
            }

            // Fix how many bits will be written in this cycle. Choose the
            // smaller of the remaining bits in the word or byte.
            final int numberOfBitsToWrite = Math.min(bitsLeftInByte, bitsLeftInWord);
            final int bitsInByteRemainingAfterWrite = (bitsLeftInByte - numberOfBitsToWrite);

            // In general, we write the highest bits of the word first, so we
            // strip the highest bits that were consumed in previous cycles.
            final long remainingBitsOfWordToWrite = (word & consumedMask);

            final long bitsThatTheByteCanAccept;
            // If there is more left in the word than can be written to this
            // byte, shift off the bits that can't be written off the bottom.
            if(bitsLeftInWord > numberOfBitsToWrite) {
                bitsThatTheByteCanAccept = (remainingBitsOfWordToWrite >>> (bitsLeftInWord - bitsLeftInByte));
            } else {
                // If the byte can accept all remaining bits, there is no need
                // to shift off the bits that won't be written in this cycle.
                bitsThatTheByteCanAccept = remainingBitsOfWordToWrite;
            }

            // Align the word bits to write up against the byte bits that have
            // already been written. This shift may do nothing if the remainder
            // of the byte is being consumed in this cycle.
            final long alignedBits = (bitsThatTheByteCanAccept << bitsInByteRemainingAfterWrite);

            // Update the byte with the alignedBits.
            bytes[byteIndex] |= (byte)alignedBits;

            // Update state with bit count written.
            bitsLeftInWord -= numberOfBitsToWrite;
            bitsLeftInByte = bitsInByteRemainingAfterWrite;
        }

        wordsWritten ++;
    }