Perform bitwise OR operations between strings.
439367
def bitop_or(self, dest, key, *keys):
        """"""
        return self.execute(b'BITOP', b'OR', dest, key, *keys)
1357483
def split_bits(value, *bits):
    
    result = []
    for b in reversed(bits):
        mask = (1 << b) - 1
        result.append(value & mask)
        value = value >> b
    assert value == 0

    result.reverse()
    return result
809430
def byte_to_bitstring(byte):
    """"""
    assert 0 <= byte <= 0xff
    bits = [int(x) for x in list(bin(byte + 0x100)[3:])]
    return bits
154817
def string_to_int( s ):
  """"""
  result = 0
  for c in s:
    if not isinstance(c, int): c = ord( c )
    result = 256 * result + c
  return result
941653
def generate_chunks(string, num_chars):
    """"""
    for start in range(0, len(string), num_chars):
        yield string[start:start+num_chars]
817394
def _bit_mismatch(int1: int, int2: int) -> int:
    """"""
    for i in range(max(int1.bit_length(), int2.bit_length())):
        if (int1 >> i) & 1 != (int2 >> i) & 1:
            return i
    return -1
655592
def Operation(self, x, y):
    """"""
    if x in y:
      return True

    # x might be an iterable
    # first we need to skip strings or we'll do silly things
    # pylint: disable=consider-merging-isinstance
    if isinstance(x, py2to3.STRING_TYPES) or isinstance(x, bytes):
      return False

    try:
      for value in x:
        if value not in y:
          return False
      return True
    except TypeError:
      return False
238474
function parseBinaryString(str) {
                var len = str.length / 32;
                var ans = new Array(len);
                for (var i = 0; i < len; i++) {
                    ans[i] = parseInt(str.substr(i*32, 32), 2) | 0;
                }
                return ans;
            }
791694
private void encode(long bits, StringBuilder sb) {
        if (bits < 0) {
            sb.append(characters[(int) ((bits % base + base) % base)]);

            bits /= -base;
        }

        while (bits > 0) {
            sb.append(characters[(int) (bits % base)]);

            bits /= base;
        }
    }
861500
function unary_tritwise_op(tt, input, input_width) {
  if (tt < -13 || tt > 13) throw new Error('unary_tritwise_op('+tt+'): out of range iii-111');
  var bt_tt = pad(3, n2bts(tt), '0');

  var input_bt = pad(input_width, n2bts(input), '0');

  var output_bt = '';

  for (var i = 0; i < input_bt.length; ++i) {
    var in_trit = BT_DIGIT_TO_N[input_bt.charAt(i)];
    var out = bt_tt.charAt(in_trit + 1);

    output_bt += out;
  }

  var output = bts2n(output_bt);

  return output;
}
867556
def _idx_to_bits(self, i):
    """"""
    bits = bin(i)[2:].zfill(self.nb_hyperplanes)  # Pad the bits str with 0
    return [-1.0 if b == "0" else 1.0 for b in bits]
1165499
def Operate(self, values):
    """"""
    for val in values:
      try:
        if self.Operation(val, self.right_operand):
          return True
      except (TypeError, ValueError):
        pass

    return False
618346
def _split(self, string):
        
        for i in range(len(string) - self.N + 1):
            yield string[i:i + self.N]
830056
function divide(bit) {
  var bitString = ((zeros + zeros) + (Number(bit).toString(2))).slice(-64);

  return [
    parseInt(bitString.slice(0, 32), 2), // hi
    parseInt(bitString.slice(-32), 2) // lo
  ];
}
939939
def bin_to_int(string):
    """"""
    if isinstance(string, str):
        return struct.unpack("b", string)[0]
    else:
        return struct.unpack("b", bytes([string]))[0]
599049
def _process_and_sort(s, force_ascii, full_process=True):
    """"""
    # pull tokens
    ts = utils.full_process(s, force_ascii=force_ascii) if full_process else s
    tokens = ts.split()

    # sort tokens and join
    sorted_string = u" ".join(sorted(tokens))
    return sorted_string.strip()
782681
def _compat_compare_digest(a, b):
    
    if len(a) != len(b):
        return False
    # Computes the bitwise difference of all characters in the two strings
    # before returning whether or not they are equal.
    difference = 0
    for (a_char, b_char) in zip(a, b):
        difference |= ord(a_char) ^ ord(b_char)
    return difference == 0