pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:4854:    break;    }       type_stack_mark();    push_finished_type(tmp);    push_finished_type(tmp2);    push_reverse_type(T_AND);    free_type(tmp);    free_type(tmp2);    return pop_unfinished_type(); -  case T_NOT: -  /* Rotate the opcode 2 bits. -  * -  * This converts A to ~A and vice versa. -  */ -  op = ((op << 2) | (op >> 2)) & PT_BINOP_ALL; -  return low_type_binop(op, a->car, b, -  remap, aflags, bflags, remap_flags); +     }    switch(b?b->type:PIKE_T_UNKNOWN) {    case T_OR:    {    struct mapping *orig_markers = NULL;    if (remap) {    /* Do not propagate marker changes between the branches    * of the T_OR node.    *    * FIXME: It is theoretically possible to propagate marker
pike.git/src/pike_types.cmod:5042:    if (!tmp) return tmp2;       type_stack_mark();    push_finished_type(tmp);    push_finished_type(tmp2);    push_reverse_type(T_OR);    }    free_type(tmp);    free_type(tmp2);    return pop_unfinished_type(); -  -  case T_NOT: -  /* Swap the bits of the opcode pairwise. -  * -  * This converts B to ~B and vice versa. -  */ -  op = (((op & PT_BINOP_B) << 1) | ((op >> 1) & PT_BINOP_B)) & PT_BINOP_ALL; -  return low_type_binop(op, a, b->car, -  remap, aflags, bflags, remap_flags); +     }       /*    * NB: At this point a and b are either NULL, a basic type or a marker.    */       loop:    switch(a ? a->type : PIKE_T_UNKNOWN) {    case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':
pike.git/src/pike_types.cmod:5668:    remap_flags ^ PT_FLAG_REMAP_SWAP_MARKERS);    push_type(T_NOT);    return pop_unfinished_type();    default:    add_ref(a);    return a;    }    }    }    +  if (a->type == T_NOT) { +  /* Rotate the opcode 2 bits. +  * +  * This converts A to ~A and vice versa. +  */ +  op = ((op << 2) | (op >> 2)) & PT_BINOP_ALL; +  return low_type_binop(op, a->car, b, remap, +  aflags, bflags, remap_flags); +  } +  if (b->type == T_NOT) { +  /* Swap the bits of the opcode pairwise. +  * +  * This converts B to ~B and vice versa. +  */ +  op = (((op & PT_BINOP_B) << 1) | ((op >> 1) & PT_BINOP_B)) & PT_BINOP_ALL; +  return low_type_binop(op, a, b->car, remap, +  aflags, bflags, remap_flags); +  } +     /* NB: TWOT(T_INT, T_ZERO) and TWOT(T_ZERO, T_INT) have    * been handled above.    */    if (((a->type == T_ZERO) || (a->type == T_INT)) &&    (bflags & PT_FLAG_CMP_NULLABLE)) {    /* FIXME: Only valid for AND and MINUS. */    b = zero_type_string;    bflags &= ~PT_FLAG_CMP_NULLABLE;    goto recur;    }
pike.git/src/pike_types.cmod:5768:    push_type(T_OR);    push_type(T_NOT);    break;    }    return pop_unfinished_type();    }       /* Invariant: a->type == b->type. */       switch(a->type) { +  case T_NOT: +  /* Reverse the order of the bits. +  * +  * 1 <=> 8 AND <=> NOR +  * 2 <=> 4 MINUS <=> INVERSE_MINUS +  * +  * This inverts both A and B. +  */ +  { +  int i; +  enum pt_binop newop = 0; +  for (i = 0; i < 4; i++) { +  newop <<= 1; +  if (op & 1) { +  newop |= 1; +  } +  op >>= 1; +  } +  return low_type_binop(newop, a->car, b->car, remap, +  aflags, bflags, remap_flags); +  } +     case T_VOID:    case T_ZERO:    case T_FLOAT:    /* Not reached. Should be handled by the a == b test at    * the beginning of the function.    */    Pike_fatal("Type hashing has duplicates.\n");    return NULL;       case T_INT: