当前位置: 首页>>代码示例>>C++>>正文


C++ TYPE_UNSIGNED函数代码示例

本文整理汇总了C++中TYPE_UNSIGNED函数的典型用法代码示例。如果您正苦于以下问题:C++ TYPE_UNSIGNED函数的具体用法?C++ TYPE_UNSIGNED怎么用?C++ TYPE_UNSIGNED使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TYPE_UNSIGNED函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: integer_cst_interesting

/* Returns true if the bound (higher for nonzero hi, otherwise lower)
 * of `cst' is not the bound implied by the type's precision and signedness. */
static bool integer_cst_interesting(tree cst, int hi)
{
    return true;
#if 0
    long long implicit_bound, explicit_bound;

    if (TYPE_UNSIGNED(cst))
        implicit_bound = (1 << TYPE_PRECISION(cst)) - 1;
    else
        implicit_bound = (1 << (TYPE_PRECISION(cst) - 1)) - 1;

    if (TYPE_UNSIGNED(cst) && TYPE_PRECISION(cst) / 8 == sizeof(implicit_bound))
        implicit_bound = (long long) -1;

    if (!hi)
    {
        if (TYPE_UNSIGNED(cst))
            implicit_bound = 0;
        else
            implicit_bound = -implicit_bound-1;
    }

    explicit_bound = (hi) ? double_int_to_ll(TREE_INT_CST(TYPE_MAX_VALUE(cst))) :
                     double_int_to_ll(TREE_INT_CST(TYPE_MIN_VALUE(cst)));

    return explicit_bound != implicit_bound;
#endif
}
开发者ID:ctz,项目名称:lighthouse,代码行数:30,代码来源:lighthouse-tree.c

示例2: supportable_convert_operation

bool
supportable_convert_operation (enum tree_code code,
			       tree vectype_out, tree vectype_in,
			       tree *decl, enum tree_code *code1)
{
  machine_mode m1,m2;
  bool truncp;

  m1 = TYPE_MODE (vectype_out);
  m2 = TYPE_MODE (vectype_in);

  /* First check if we can done conversion directly.  */
  if ((code == FIX_TRUNC_EXPR
       && can_fix_p (m1,m2,TYPE_UNSIGNED (vectype_out), &truncp)
	  != CODE_FOR_nothing)
      || (code == FLOAT_EXPR
	  && can_float_p (m1,m2,TYPE_UNSIGNED (vectype_in))
	     != CODE_FOR_nothing))
    {
      *code1 = code;
      return true;
    }

  /* Now check for builtin.  */
  if (targetm.vectorize.builtin_conversion
      && targetm.vectorize.builtin_conversion (code, vectype_out, vectype_in))
    {
      *code1 = CALL_EXPR;
      *decl = targetm.vectorize.builtin_conversion (code, vectype_out,
						    vectype_in);
      return true;
    }
  return false;
}
开发者ID:ewang1986,项目名称:gcc,代码行数:34,代码来源:optabs-tree.c

示例3: value_args_as_target_float

/* Obtain argument values for binary operation, converting from
   other types if one of them is not floating point.  */
static void
value_args_as_target_float (struct value *arg1, struct value *arg2,
			    gdb_byte *x, struct type **eff_type_x,
			    gdb_byte *y, struct type **eff_type_y)
{
  struct type *type1, *type2;

  type1 = check_typedef (value_type (arg1));
  type2 = check_typedef (value_type (arg2));

  /* At least one of the arguments must be of floating-point type.  */
  gdb_assert (is_floating_type (type1) || is_floating_type (type2));

  if (is_floating_type (type1) && is_floating_type (type2)
      && TYPE_CODE (type1) != TYPE_CODE (type2))
    /* The DFP extension to the C language does not allow mixing of
     * decimal float types with other float types in expressions
     * (see WDTR 24732, page 12).  */
    error (_("Mixing decimal floating types with "
	     "other floating types is not allowed."));

  /* Obtain value of arg1, converting from other types if necessary.  */

  if (is_floating_type (type1))
    {
      *eff_type_x = type1;
      memcpy (x, value_contents (arg1), TYPE_LENGTH (type1));
    }
  else if (is_integral_type (type1))
    {
      *eff_type_x = type2;
      if (TYPE_UNSIGNED (type1))
	target_float_from_ulongest (x, *eff_type_x, value_as_long (arg1));
      else
	target_float_from_longest (x, *eff_type_x, value_as_long (arg1));
    }
  else
    error (_("Don't know how to convert from %s to %s."), TYPE_NAME (type1),
	     TYPE_NAME (type2));

  /* Obtain value of arg2, converting from other types if necessary.  */

  if (is_floating_type (type2))
    {
      *eff_type_y = type2;
      memcpy (y, value_contents (arg2), TYPE_LENGTH (type2));
    }
  else if (is_integral_type (type2))
    {
      *eff_type_y = type1;
      if (TYPE_UNSIGNED (type2))
	target_float_from_ulongest (y, *eff_type_y, value_as_long (arg2));
      else
	target_float_from_longest (y, *eff_type_y, value_as_long (arg2));
    }
  else
    error (_("Don't know how to convert from %s to %s."), TYPE_NAME (type1),
	     TYPE_NAME (type2));
}
开发者ID:bminor,项目名称:binutils-gdb,代码行数:61,代码来源:valarith.c

示例4: pp_c_character_constant

static void
pp_c_character_constant (c_pretty_printer *pp, tree c)
{
  tree type = TREE_TYPE (c);
  if (type == wchar_type_node)
    pp_character (pp, 'L');
  pp_quote (pp);
  if (host_integerp (c, TYPE_UNSIGNED (type)))
    pp_c_char (pp, tree_low_cst (c, TYPE_UNSIGNED (type)));
  else
    pp_scalar (pp, "\\x%x", (unsigned) TREE_INT_CST_LOW (c));
  pp_quote (pp);
}
开发者ID:DmitrySkiba,项目名称:itoa-toolchain,代码行数:13,代码来源:c-pretty-print.c

示例5: pp_c_integer_constant

static void
pp_c_integer_constant (c_pretty_printer *pp, tree i)
{
  tree type = TREE_TYPE (i);

  if (TREE_INT_CST_HIGH (i) == 0)
    pp_wide_integer (pp, TREE_INT_CST_LOW (i));
  else
    {
      if (tree_int_cst_sgn (i) < 0)
	{
	  pp_character (pp, '-');
	  i = build_int_cst_wide (NULL_TREE,
				  -TREE_INT_CST_LOW (i),
				  ~TREE_INT_CST_HIGH (i)
				  + !TREE_INT_CST_LOW (i));
	}
      sprintf (pp_buffer (pp)->digit_buffer,
	       HOST_WIDE_INT_PRINT_DOUBLE_HEX,
	       TREE_INT_CST_HIGH (i), TREE_INT_CST_LOW (i));
      pp_string (pp, pp_buffer (pp)->digit_buffer);
    }
  if (TYPE_UNSIGNED (type))
    pp_character (pp, 'u');
  if (type == long_integer_type_node || type == long_unsigned_type_node)
    pp_character (pp, 'l');
  else if (type == long_long_integer_type_node
	   || type == long_long_unsigned_type_node)
    pp_string (pp, "ll");
}
开发者ID:DmitrySkiba,项目名称:itoa-toolchain,代码行数:30,代码来源:c-pretty-print.c

示例6: same_type

/* Returns non-zero if the two types are the same */
int
same_type (struct type *arg1, struct type *arg2)
{
    CHECK_TYPEDEF (type);
    if (structured_type (arg1) ? !structured_type (arg2) : structured_type (arg2))
        /* One is structured and one isn't */
        return 0;
    else if (structured_type (arg1) && structured_type (arg2))
        return arg1 == arg2;
    else if (numeric_type (arg1) && numeric_type (arg2))
        return (TYPE_CODE (arg2) == TYPE_CODE (arg1)) &&
               (TYPE_UNSIGNED (arg1) == TYPE_UNSIGNED (arg2))
               ? 1 : 0;
    else
        return arg1 == arg2;
}
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:17,代码来源:language.c

示例7: unpack_ts_base_value_fields

static inline void
unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
{
  /* Note that the code for EXPR has already been unpacked to create EXPR in
     streamer_alloc_tree.  */
  if (!TYPE_P (expr))
    {
      TREE_SIDE_EFFECTS (expr) = (unsigned) bp_unpack_value (bp, 1);
      TREE_CONSTANT (expr) = (unsigned) bp_unpack_value (bp, 1);
      TREE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1);

      /* TREE_PUBLIC is used on types to indicate that the type
	 has a TYPE_CACHED_VALUES vector.  This is not streamed out,
	 so we skip it here.  */
      TREE_PUBLIC (expr) = (unsigned) bp_unpack_value (bp, 1);
    }
  else
    bp_unpack_value (bp, 4);
  TREE_ADDRESSABLE (expr) = (unsigned) bp_unpack_value (bp, 1);
  TREE_THIS_VOLATILE (expr) = (unsigned) bp_unpack_value (bp, 1);
  if (DECL_P (expr))
    DECL_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1);
  else if (TYPE_P (expr))
    TYPE_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1);
  else
    bp_unpack_value (bp, 1);
  TREE_ASM_WRITTEN (expr) = (unsigned) bp_unpack_value (bp, 1);
  if (TYPE_P (expr))
    TYPE_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1);
  else
    TREE_NO_WARNING (expr) = (unsigned) bp_unpack_value (bp, 1);
  TREE_NOTHROW (expr) = (unsigned) bp_unpack_value (bp, 1);
  TREE_STATIC (expr) = (unsigned) bp_unpack_value (bp, 1);
  if (TREE_CODE (expr) != TREE_BINFO)
    TREE_PRIVATE (expr) = (unsigned) bp_unpack_value (bp, 1);
  else
    bp_unpack_value (bp, 1);
  TREE_PROTECTED (expr) = (unsigned) bp_unpack_value (bp, 1);
  TREE_DEPRECATED (expr) = (unsigned) bp_unpack_value (bp, 1);
  if (TYPE_P (expr))
    {
      if (AGGREGATE_TYPE_P (expr))
	TYPE_REVERSE_STORAGE_ORDER (expr) = (unsigned) bp_unpack_value (bp, 1);
      else
	TYPE_SATURATING (expr) = (unsigned) bp_unpack_value (bp, 1);
      TYPE_ADDR_SPACE (expr) = (unsigned) bp_unpack_value (bp, 8);
    }
  else if (TREE_CODE (expr) == BIT_FIELD_REF || TREE_CODE (expr) == MEM_REF)
    {
      REF_REVERSE_STORAGE_ORDER (expr) = (unsigned) bp_unpack_value (bp, 1);
      bp_unpack_value (bp, 8);
    }
  else if (TREE_CODE (expr) == SSA_NAME)
    {
      SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1);
      bp_unpack_value (bp, 8);
    }
  else
    bp_unpack_value (bp, 9);
}
开发者ID:pjump,项目名称:gcc,代码行数:60,代码来源:tree-streamer-in.c

示例8: adjust_type_signedness

/* Make TYPE unsigned if its range of values includes no negatives.  */
static void
adjust_type_signedness (struct type *type)
{
  if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
      && TYPE_LOW_BOUND (type) >= 0)
    TYPE_UNSIGNED (type) = 1;
}
开发者ID:kraj,项目名称:binutils-gdb,代码行数:8,代码来源:ada-valprint.c

示例9: insert_part_to_rtx_on_edge

static void
insert_part_to_rtx_on_edge (edge e, rtx dest, int src, source_location locus)
{
  tree var;
  rtx seq;
  if (dump_file && (dump_flags & TDF_DETAILS))
    {
      fprintf (dump_file,
	       "Inserting a temp copy on edge BB%d->BB%d : ",
	       e->src->index,
	       e->dest->index);
      print_simple_rtl (dump_file, dest);
      fprintf (dump_file, "= PART.%d\n", src);
    }

  gcc_assert (SA.partition_to_pseudo[src]);

  set_location_for_edge (e);
  /* If a locus is provided, override the default.  */
  if (locus)
    set_curr_insn_source_location (locus);

  var = partition_to_var (SA.map, src);
  seq = emit_partition_copy (dest,
			     SA.partition_to_pseudo[src],
			     TYPE_UNSIGNED (TREE_TYPE (var)),
			     var);

  insert_insn_on_edge (seq, e);
}
开发者ID:Quantumboost,项目名称:gcc,代码行数:30,代码来源:tree-outof-ssa.c

示例10: expand_one_register_var

static void
expand_one_register_var (tree var)
{
  tree type = TREE_TYPE (var);
  int unsignedp = TYPE_UNSIGNED (type);
  enum machine_mode reg_mode
    = promote_mode (type, DECL_MODE (var), &unsignedp, 0);
  rtx x = gen_reg_rtx (reg_mode);

  SET_DECL_RTL (var, x);

  /* Note if the object is a user variable.  */
  if (!DECL_ARTIFICIAL (var))
    {
      mark_user_reg (x);

      /* Trust user variables which have a pointer type to really
	 be pointers.  Do not trust compiler generated temporaries
	 as our type system is totally busted as it relates to
	 pointer arithmetic which translates into lots of compiler
	 generated objects with pointer types, but which are not really
	 pointers.  */
      if (POINTER_TYPE_P (type))
	mark_reg_pointer (x, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (var))));
    }
}
开发者ID:seguljac,项目名称:higpu,代码行数:26,代码来源:cfgexpand.c

示例11: ubsan_instrument_division

tree
ubsan_instrument_division (location_t loc, tree op0, tree op1)
{
  tree t, tt;
  tree type = TREE_TYPE (op0);

  /* At this point both operands should have the same type,
     because they are already converted to RESULT_TYPE.
     Use TYPE_MAIN_VARIANT since typedefs can confuse us.  */
  gcc_assert (TYPE_MAIN_VARIANT (TREE_TYPE (op0))
	      == TYPE_MAIN_VARIANT (TREE_TYPE (op1)));

  /* TODO: REAL_TYPE is not supported yet.  */
  if (TREE_CODE (type) != INTEGER_TYPE)
    return NULL_TREE;

  t = fold_build2 (EQ_EXPR, boolean_type_node,
		    op1, build_int_cst (type, 0));

  /* We check INT_MIN / -1 only for signed types.  */
  if (!TYPE_UNSIGNED (type))
    {
      tree x;
      tt = fold_build2 (EQ_EXPR, boolean_type_node, op1,
			build_int_cst (type, -1));
      x = fold_build2 (EQ_EXPR, boolean_type_node, op0,
		       TYPE_MIN_VALUE (type));
      x = fold_build2 (TRUTH_AND_EXPR, boolean_type_node, x, tt);
      t = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, t, x);
    }

  /* If the condition was folded to 0, no need to instrument
     this expression.  */
  if (integer_zerop (t))
    return NULL_TREE;

  /* In case we have a SAVE_EXPR in a conditional context, we need to
     make sure it gets evaluated before the condition.  */
  t = fold_build2 (COMPOUND_EXPR, TREE_TYPE (t), op0, t);
  if (flag_sanitize_undefined_trap_on_error)
    tt = build_call_expr_loc (loc, builtin_decl_explicit (BUILT_IN_TRAP), 0);
  else
    {
      tree data = ubsan_create_data ("__ubsan_overflow_data", &loc, NULL,
				     ubsan_type_descriptor (type, false),
				     NULL_TREE);
      data = build_fold_addr_expr_loc (loc, data);
      enum built_in_function bcode
	= flag_sanitize_recover
	  ? BUILT_IN_UBSAN_HANDLE_DIVREM_OVERFLOW
	  : BUILT_IN_UBSAN_HANDLE_DIVREM_OVERFLOW_ABORT;
      tt = builtin_decl_explicit (bcode);
      tt = build_call_expr_loc (loc, tt, 3, data, ubsan_encode_value (op0),
				ubsan_encode_value (op1));
    }
  t = fold_build3 (COND_EXPR, void_type_node, t, tt, void_zero_node);

  return t;
}
开发者ID:kleopatra999,项目名称:gcc,代码行数:59,代码来源:c-ubsan.c

示例12: expand_vec_cmp_expr_p

bool
expand_vec_cmp_expr_p (tree value_type, tree mask_type)
{
  enum insn_code icode = get_vec_cmp_icode (TYPE_MODE (value_type),
					    TYPE_MODE (mask_type),
					    TYPE_UNSIGNED (value_type));
  return (icode != CODE_FOR_nothing);
}
开发者ID:ewang1986,项目名称:gcc,代码行数:8,代码来源:optabs-tree.c

示例13: ada_value_print

int
ada_value_print (struct value *val0, struct ui_file *stream, int format,
		 enum val_prettyprint pretty)
{
  char *valaddr = VALUE_CONTENTS (val0);
  CORE_ADDR address = VALUE_ADDRESS (val0) + VALUE_OFFSET (val0);
  struct type *type =
    ada_to_fixed_type (VALUE_TYPE (val0), valaddr, address, NULL);
  struct value *val =
    value_from_contents_and_address (type, valaddr, address);

  /* If it is a pointer, indicate what it points to.  */
  if (TYPE_CODE (type) == TYPE_CODE_PTR)
    {
      /* Hack:  don't print (char *) for char strings.  Their
         type is indicated by the quoted string anyway.  */
      if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) != sizeof (char)
	  || TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_INT 
	  || TYPE_UNSIGNED (TYPE_TARGET_TYPE (type)))
	{
	  fprintf_filtered (stream, "(");
	  type_print (type, "", stream, -1);
	  fprintf_filtered (stream, ") ");
	}
    }
  else if (ada_is_array_descriptor_type (type))
    {
      fprintf_filtered (stream, "(");
      type_print (type, "", stream, -1);
      fprintf_filtered (stream, ") ");
    }
  else if (ada_is_bogus_array_descriptor (type))
    {
      fprintf_filtered (stream, "(");
      type_print (type, "", stream, -1);
      fprintf_filtered (stream, ") (...?)");
      return 0;
    }

  if (TYPE_CODE (type) == TYPE_CODE_ARRAY
      && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == 0
      && TYPE_CODE (TYPE_INDEX_TYPE (type)) == TYPE_CODE_RANGE)
    {
      /* This is an array of zero-length elements, that is an array
         of null records.  This array needs to be printed by hand,
         as the standard routine to print arrays relies on the size of
         the array elements to be nonzero.  This is because it computes
         the number of elements in the array by dividing the array size
         by the array element size.  */
      fprintf_filtered (stream, "(%d .. %d => ())",
                        TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type)),
                        TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (type)));
      return 0;
    }
  
  return (val_print (type, VALUE_CONTENTS (val), 0, address,
		     stream, format, 1, 0, pretty));
}
开发者ID:sjohnston-adventiumlabs,项目名称:xen-micart-scheduler,代码行数:58,代码来源:ada-valprint.c

示例14: get_ubsan_type_info_for_type

static unsigned short
get_ubsan_type_info_for_type (tree type)
{
    int prec = exact_log2 (TYPE_PRECISION (type));
    if (prec == -1)
        error ("unexpected size of type %qT", type);

    return (prec << 1) | !TYPE_UNSIGNED (type);
}
开发者ID:rgmabs19357,项目名称:gcc,代码行数:9,代码来源:ubsan.c

示例15: tree_get_random_const

static tree tree_get_random_const(tree type)
{
	unsigned long long mask;

	mask = 1ULL << (TREE_INT_CST_LOW(TYPE_SIZE(type)) - 1);
	mask = 2 * (mask - 1) + 1;

	if (TYPE_UNSIGNED(type))
		return build_int_cstu(type, mask & get_random_const());
	return build_int_cst(type, mask & get_random_const());
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:11,代码来源:latent_entropy_plugin.c


注:本文中的TYPE_UNSIGNED函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。