unsigned int more_than_enough_bits_for_digits;
unsigned int more_than_enough_littlenums_for_digits;
unsigned int size_of_digits_in_littlenums;
- unsigned int size_of_digits_in_chars;
FLONUM_TYPE power_of_10_flonum;
FLONUM_TYPE digits_flonum;
number_of_digits_to_use = number_of_digits_available;
}
- /* Cast these to SIGNED LONG first, otherwise, on systems with
- LONG wider than INT (such as Alpha OSF/1), unsignedness may
- cause unexpected results. */
- decimal_exponent += ((long) number_of_digits_before_decimal
- - (long) number_of_digits_to_use);
+ decimal_exponent += number_of_digits_before_decimal;
+ decimal_exponent -= number_of_digits_to_use;
more_than_enough_bits_for_digits
= (number_of_digits_to_use * 3321928 / 1000000 + 1);
object). */
size_of_digits_in_littlenums = more_than_enough_littlenums_for_digits;
- size_of_digits_in_chars = size_of_digits_in_littlenums
- * sizeof (LITTLENUM_TYPE);
- digits_binary_low = (LITTLENUM_TYPE *)
- xmalloc (size_of_digits_in_chars);
-
- memset ((char *) digits_binary_low, '\0', size_of_digits_in_chars);
+ digits_binary_low = xcalloc (size_of_digits_in_littlenums,
+ sizeof (LITTLENUM_TYPE));
/* Digits_binary_low[] is allocated and zeroed. */
/* From now on: the decimal exponent is > 0. Its sign is separate. */
- size_of_power_in_chars = size_of_power_in_littlenums
- * sizeof (LITTLENUM_TYPE) + 2;
+ size_of_power_in_chars = (size_of_power_in_littlenums
+ * sizeof (LITTLENUM_TYPE)) + 2;
- power_binary_low = (LITTLENUM_TYPE *) xmalloc (size_of_power_in_chars);
- temporary_binary_low = (LITTLENUM_TYPE *) xmalloc (size_of_power_in_chars);
+ power_binary_low = xmalloc (size_of_power_in_chars);
+ temporary_binary_low = xmalloc (size_of_power_in_chars);
- memset ((char *) power_binary_low, '\0', size_of_power_in_chars);
+ memset (power_binary_low, '\0', size_of_power_in_chars);
*power_binary_low = 1;
power_of_10_flonum.exponent = 0;
power_of_10_flonum.low = power_binary_low;
#ifdef TRACE
static void
-flonum_print (f)
- const FLONUM_TYPE *f;
+flonum_print (const FLONUM_TYPE *f)
{
LITTLENUM_TYPE *lp;
char littlenum_format[10];
else
{
if (s[-1] != '.')
- return (current_cframe != NULL) && (current_cframe->ignoring);
+ return current_cframe != NULL && current_cframe->ignoring;
}
/* We cannot ignore certain pseudo ops. */
break;
}
- return (current_cframe != NULL) && (current_cframe->ignoring);
+ return current_cframe != NULL && current_cframe->ignoring;
}
static void
initialize_cframe (struct conditional_frame *cframe)
{
memset (cframe, 0, sizeof (*cframe));
- cframe->if_file_line.file
- = as_where (&cframe->if_file_line.line);
+ cframe->if_file_line.file = as_where (&cframe->if_file_line.line);
cframe->previous_cframe = current_cframe;
cframe->dead_tree = current_cframe != NULL && current_cframe->ignoring;
cframe->macro_nest = macro_nest;
{
as_bad (_("cannot create floating-point number"));
/* Zero the leftmost bit. */
- words[0] = (LITTLENUM_TYPE) ((unsigned) -1) >> 1;
- words[1] = (LITTLENUM_TYPE) -1;
- words[2] = (LITTLENUM_TYPE) -1;
- words[3] = (LITTLENUM_TYPE) -1;
- words[4] = (LITTLENUM_TYPE) -1;
- words[5] = (LITTLENUM_TYPE) -1;
+ words[0] = (LITTLENUM_TYPE) -1 >> 1;
+ words[1] = -1;
+ words[2] = -1;
+ words[3] = -1;
+ words[4] = -1;
+ words[5] = -1;
}
/* Build a floating point constant at str into a IEEE floating
default:
make_invalid_floating_point_number (words);
- return (NULL);
+ return NULL;
}
return atof_ieee_detail (str, precision, exponent_bits, words, NULL);
{
int cur = 0;
int found = 0;
- int tok_sz = token->end - token->begin;
+ size_t tok_sz = token->end - token->begin;
char *tok = token->insn + token->begin;
expressionS exp;
for (int i = 0; !found && i < class[cur].sz; ++i)
{
const char *ref = class[cur].class_values[i];
- found = ((long) strlen (ref) == tok_sz) && !strncmp (tok, ref, tok_sz);
+ found = (strlen (ref) == tok_sz) && !strncmp (tok, ref, tok_sz);
token->val = i;
}
create_token (struct token_s tok, int len, int loc)
{
struct token_list *tl = calloc (1, sizeof *tl);
- int tok_sz = tok.end - tok.begin;
+ size_t tok_sz = tok.end - tok.begin;
tl->tok = calloc (tok_sz + 1, sizeof (char));
memcpy (tl->tok, tok.insn + tok.begin, tok_sz * sizeof (char));
tl->val = tok.val;
if (push && ISDIGIT (*input_line_pointer))
{
/* .pushsection has an optional subsection. */
- new_subsection = (subsegT) get_absolute_expression ();
+ new_subsection = get_absolute_expression ();
SKIP_WHITESPACE ();
char *t = input_line_pointer;
match.sh_info = strtoul (input_line_pointer,
&input_line_pointer, 0);
- if (match.sh_info == (unsigned int) -1)
+ if (match.sh_info == -1u)
{
as_warn (_("unsupported mbind section info: %s"), t);
match.sh_info = 0;
errno = 0;
id = strtoul (input_line_pointer,
&input_line_pointer, 0);
- overflow = (id == (unsigned long) -1
- && errno == ERANGE);
+ overflow = id == -1ul && errno == ERANGE;
}
else
{
(const char **) &input_line_pointer, 0);
overflow = id == ~(bfd_vma) 0;
}
- if (overflow || id > (unsigned int) -1)
+ if (overflow || id > -1u)
{
char *linefeed, saved_char = 0;
if ((linefeed = strchr (t, '\n')) != NULL)
SKIP_WHITESPACE ();
if (*input_line_pointer == ',')
{
- align = (unsigned int) parse_align (0);
- if (align == (unsigned int) -1)
+ align = parse_align (0);
+ if (align == -1u)
{
as_warn (_("align value not recognized, using size"));
align = size;
entry size, we're dead ... */
gas_assert (eltsiz != 0);
- ncalc = (unsigned int) (sect_size / eltsiz);
+ ncalc = sect_size / eltsiz;
if (nactual != ncalc)
as_bad (_("the number of .indirect_symbols defined in section %s"
" does not match the number expected (%d defined, %d"
case BFD_RELOC_CKCORE_PCREL_IMM8BY4:
case BFD_RELOC_CKCORE_PCREL_IMM10BY4:
case BFD_RELOC_CKCORE_PCREL_IMM16BY4:
- max = (offsetT) howto->dst_mask;
+ max = howto->dst_mask;
min = 0;
break;
/* lrw16. */
case BFD_RELOC_CKCORE_PCREL_IMM7BY4:
if (do_extend_lrw)
- max = (offsetT)((1 << (howto->bitsize + 1)) - 2);
+ max = ((valueT) 1 << (howto->bitsize + 1)) - 2;
else
- max = (offsetT)((1 << howto->bitsize) - 1);
+ max = ((valueT) 1 << howto->bitsize) - 1;
min = 0;
break;
/* flrws, flrwd: the offset bits are divided in two parts. */
case BFD_RELOC_CKCORE_PCREL_FLRW_IMM8BY4:
- max = (offsetT)((1 << howto->bitsize) - 1);
+ max = ((valueT) 1 << howto->bitsize) - 1;
min = 0;
break;
/* Offset is signed. */
default:
- max = (offsetT)(howto->dst_mask >> 1);
+ max = howto->dst_mask >> 1;
min = - max - 1;
issigned = 1;
}
if (do_extend_lrw && (opcode & 0xfc00) == CSKYV2_INST_LRW16)
val &= 0xff;
else
- val &= issigned ? (offsetT)(howto->dst_mask) : max;
+ val &= issigned ? (offsetT) howto->dst_mask : max;
if (fixP->fx_r_type == BFD_RELOC_CKCORE_PCREL_BLOOP_IMM4BY4)
val = (val & 0xf) << 12;
fix_ld_st_operand (unsigned long opcode, char* str)
{
/* Check the opcode. */
- switch ((int) opcode)
+ switch (opcode)
{
case LBOP:
case LBUOP:
if (fragP->fr_type == rs_machine_dependent)
{
- switch ((int) fragP->fr_subtype)
+ switch (fragP->fr_subtype)
{
case 0:
fragP->fr_type = rs_fill;
than BFD understands. This is how we get this information
to the SOM BFD backend. */
#ifdef obj_set_symbol_type
- obj_set_symbol_type (bfdsym, (int) type);
+ obj_set_symbol_type (bfdsym, type);
#else
(void) type;
#endif
/* Now that all the flags are set, update an existing subspace,
or create a new one. */
if (ssd)
-
current_subspace = update_subspace (space, ss_name, loadable,
code_only, comdat, common,
dup_common, sort, zero, access_ctr,
for (subspace_chain = space_chain->sd_subspaces;
subspace_chain;
subspace_chain = subspace_chain->ssd_next)
- if (subspace_chain->ssd_subseg == (int) subseg)
+ if (subspace_chain->ssd_subseg == subseg)
return subspace_chain;
}
}
hppa_fixp = fixp->tc_fix_data;
#ifdef OBJ_SOM
- if (fixp->fx_r_type == (int) R_HPPA_ENTRY
- || fixp->fx_r_type == (int) R_HPPA_EXIT
- || fixp->fx_r_type == (int) R_HPPA_BEGIN_BRTAB
- || fixp->fx_r_type == (int) R_HPPA_END_BRTAB
- || fixp->fx_r_type == (int) R_HPPA_BEGIN_TRY
- || fixp->fx_r_type == (int) R_HPPA_END_TRY
+ if (fixp->fx_r_type == R_HPPA_ENTRY
+ || fixp->fx_r_type == R_HPPA_EXIT
+ || fixp->fx_r_type == R_HPPA_BEGIN_BRTAB
+ || fixp->fx_r_type == R_HPPA_END_BRTAB
+ || fixp->fx_r_type == R_HPPA_BEGIN_TRY
+ || fixp->fx_r_type == R_HPPA_END_TRY
|| (fixp->fx_addsy != NULL && fixp->fx_subsy != NULL
&& (hppa_fixp->segment->flags & SEC_CODE) != 0))
return 1;
struct unw_rec_list *next;
} unw_rec_list;
-#define SLOT_NUM_NOT_SET (unsigned)-1
+#define SLOT_NUM_NOT_SET -1UL
/* Linked list of saved prologue counts. A very poor
implementation of a map from label numbers to prologue counts. */
const char *sec_name;
char *sym_name;
char c;
- offsetT size;
- offsetT cur_size;
- offsetT temp;
+ valueT size;
+ valueT cur_size;
+ valueT temp;
symbolS *symbolP;
segT current_seg = now_seg;
subsegT current_subseg = now_subseg;
temp = get_absolute_expression ();
size = temp;
- size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
+ size &= ((valueT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
if (temp != size)
{
as_warn (_("size (%ld) out of range, ignored"), (long) temp);
record_alignment (now_seg, log_align);
cur_size = bfd_section_size (now_seg);
- if ((int) size > cur_size)
+ if (size > cur_size)
{
char *pfrag = frag_var (rs_fill, 1, 1, 0, NULL, size - cur_size, NULL);
*pfrag = 0;
symbolS *p;
c = get_symbol_name (&name);
- p = (symbolS *) symbol_find_or_make (name);
+ p = symbol_find_or_make (name);
(void) restore_line_pointer (c);
return p;
}
/* This is a hack which works because the Bundling is the same for all cores
for now. */
- switch ((int) op->bundling)
+ switch (op->bundling)
{
case Bundling_kv3_v1_ALL:
insn_type = "ALL ";
tag = -1, exu = -1;
/* This is a hack. It works because all the Bundling are the same for all
cores for now. */
- switch ((int) find_bundling (kvxinsn))
+ switch (find_bundling (kvxinsn))
{
case Bundling_kv3_v1_ALL:
if (bundle_insncnt > 1)
align_sec_sym_hash (const void *entry)
{
const align_sec_sym *e = entry;
- return (hashval_t) (e->sec_id);
+ return e->sec_id;
}
static int
if (negated)
not_current_architecture |= (ext->control_regs
- ? *(unsigned *)ext->control_regs: ext->arch);
+ ? *ext->control_regs: ext->arch);
else
current_architecture |= ext->arch;
return 1;
}
else
as_bad (_("register expected, but saw '%.6s'"), s);
- if ((int) tmpreg >= MIN_PVR_REGNUM && tmpreg <= MAX_PVR_REGNUM)
+ if (tmpreg - MIN_PVR_REGNUM <= MAX_PVR_REGNUM - MIN_PVR_REGNUM)
*reg = REG_PVR + tmpreg;
else
{
else
as_bad (_("register expected, but saw '%.6s'"), s);
- if ((int) tmpreg >= MIN_REGNUM && tmpreg <= MAX_REGNUM)
+ if (tmpreg - MIN_REGNUM <= MAX_REGNUM - MIN_REGNUM)
*reg = tmpreg;
else
{
else
as_bad (_("register expected, but saw '%.6s'"), s);
- if ((int)tmpreg >= MIN_REGNUM && tmpreg <= MAX_REGNUM)
+ if (tmpreg - MIN_REGNUM <= MAX_REGNUM - MIN_REGNUM)
*reg = tmpreg;
else
{
but it's not clear that it would actually improve performance. */
#define RELAX_BRANCH_ENCODE(at, pic, \
uncond, likely, link, toofar) \
- ((relax_substateT) \
- (0xc0000000 \
+ ((0xc0000000 \
| ((at) & 0x1f) \
| ((pic) ? 0x20 : 0) \
| ((toofar) ? 0x40 : 0) \
symbolS *p;
c = get_symbol_name (&name);
- p = (symbolS *) symbol_find_or_make (name);
+ p = symbol_find_or_make (name);
(void) restore_line_pointer (c);
return p;
}
case BFD_RELOC_MMIX_PUSHJ_STUBBABLE:
/* If this fixup is out of range, punt to the linker to emit an
error. This should only happen with -no-expand. */
- if (val < -(((offsetT) 1 << 19)/2)
- || val >= ((offsetT) 1 << 19)/2 - 1
+ if (val < -((1 << 19) / 2)
+ || val >= (1 << 19) / 2 - 1
|| (val & 3) != 0)
{
if (warn_on_expansion)
case BFD_RELOC_MMIX_JMP:
/* If this fixup is out of range, punt to the linker to emit an
error. This should only happen with -no-expand. */
- if (val < -(((offsetT) 1 << 27)/2)
- || val >= ((offsetT) 1 << 27)/2 - 1
+ if (val < -((1 << 27) / 2)
+ || val >= (1 << 27) / 2 - 1
|| (val & 3) != 0)
{
if (warn_on_expansion)
&& (bfd_vma) val + 256 > lowest_data_loc
&& bfd_is_abs_section (addsec))
{
- val -= (offsetT) lowest_data_loc;
+ val -= lowest_data_loc;
addsy = section_symbol (data_section);
}
/* Likewise text section. */
&& (bfd_vma) val + 256 > lowest_text_loc
&& bfd_is_abs_section (addsec))
{
- val -= (offsetT) lowest_text_loc;
+ val -= lowest_text_loc;
addsy = section_symbol (text_section);
}
}
if (fragP == seginfo->tc_segment_info_data.last_stubfrag)
seginfo->tc_segment_info_data.nstubs = 0;
- return
- (mmix_relax_table[fragP->fr_subtype].rlx_length
- - mmix_relax_table[prev_type].rlx_length);
+ return (mmix_relax_table[fragP->fr_subtype].rlx_length
+ - mmix_relax_table[prev_type].rlx_length);
}
case ENCODE_RELAX (STATE_PUSHJ, STATE_MAX):
if (! merge_gregs)
continue;
- osymval = (offsetT) S_GET_VALUE (symbolP);
+ osymval = S_GET_VALUE (symbolP);
osymfrag = symbol_get_frag (symbolP);
/* If the symbol isn't defined, we can't say that another symbol
}
sym = fixP->fx_addsy;
- offs = (offsetT) fixP->fx_offset;
+ offs = fixP->fx_offset;
/* If the symbol is defined, then it must be resolved to a section
symbol at this time, or else we don't know how to handle it. */
&& (bfd_vma) offs + 256 > lowest_data_loc
&& bfd_is_abs_section (S_GET_SEGMENT (sym)))
{
- offs -= (offsetT) lowest_data_loc;
+ offs -= lowest_data_loc;
sym = section_symbol (data_section);
}
/* Likewise text section. */
&& (bfd_vma) offs + 256 > lowest_text_loc
&& bfd_is_abs_section (S_GET_SEGMENT (sym)))
{
- offs -= (offsetT) lowest_text_loc;
+ offs -= lowest_text_loc;
sym = section_symbol (text_section);
}
if (operand->bits < 24
&& (operand->flags & MN10200_OPERAND_NOCHECK) == 0)
{
- long min, max;
- offsetT test;
+ offsetT min, max;
if ((operand->flags & MN10200_OPERAND_SIGNED) != 0)
{
min = 0;
}
- test = val;
-
- if (test < min || test > max)
- as_warn_value_out_of_range (_("operand"), test, (offsetT) min,
- (offsetT) max, file, line);
+ if (val < min || val > max)
+ as_warn_value_out_of_range (_("operand"), val, min, max, file, line);
}
if ((operand->flags & MN10200_OPERAND_EXTENDED) == 0)
test = val;
- if (test < (offsetT) min || test > (offsetT) max)
+ if (test < min || test > max)
return false;
}
return true;
test = val;
- if (test < (offsetT) min || test > (offsetT) max)
- as_warn_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line);
+ if (test < min || test > max)
+ as_warn_value_out_of_range (_("operand"), test, (offsetT) min,
+ (offsetT) max, file, line);
}
if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
}
else if ((operand->flags & MN10300_OPERAND_EXTENDED) == 0)
{
- *insnp |= (((long) val & ((1 << operand->bits) - 1))
+ *insnp |= ((val & ((1 << operand->bits) - 1))
<< (operand->shift + shift));
if ((operand->flags & MN10300_OPERAND_REPEATED) != 0)
- *insnp |= (((long) val & ((1 << operand->bits) - 1))
+ *insnp |= ((val & ((1 << operand->bits) - 1))
<< (operand->shift + shift + operand->bits));
}
else
{
- *extensionp |= (((long) val & ((1 << operand->bits) - 1))
+ *extensionp |= ((val & ((1 << operand->bits) - 1))
<< (operand->shift + shift));
if ((operand->flags & MN10300_OPERAND_REPEATED) != 0)
- *extensionp |= (((long) val & ((1 << operand->bits) - 1))
+ *extensionp |= ((val & ((1 << operand->bits) - 1))
<< (operand->shift + shift + operand->bits));
}
}
/* Only frag by alignment when needed.
Otherwise, it will fail to optimize labels on 4-byte boundary. (bug8454)
See md_convert_frag () and RELAX_SET_RELAXABLE (frag) for details. */
- if (frag_now_fix () & ((1 << n) -1 ))
+ if (frag_now_fix () & (((addressT) 1 << n) - 1))
{
if (subseg_text_p (now_seg))
{
old_frag = symbol_get_frag (label);
old_value = S_GET_VALUE (label);
- new_value = (valueT) frag_now_fix ();
+ new_value = frag_now_fix ();
/* Multiple labels may be on the same address. And the last symbol
may not be a label at all, e.g., register name, external function names,
/* Is the buffer large enough? */
#define MAX_BUFFER 12
-static char *nds_itoa (int n);
-
static char *
nds_itoa (int n)
{
old_frag = symbol_get_frag (label);
old_value = S_GET_VALUE (label);
- new_value = (valueT) frag_now_fix ();
+ new_value = frag_now_fix ();
/* It is possible to have more than one label at a particular
address, especially if debugging is enabled, so we must
if (pru_mode == PRU_MODE_TEST && ep->X_op == O_constant)
value = ep->X_add_number;
- return (unsigned long) value;
+ return value;
}
/* Try to parse a non-relocatable expression. */
SET_INSN_FIELD (RS2, insn_info->insn_code, src2->index);
SET_INSN_FIELD (RS2SEL, insn_info->insn_code, src2->regsel);
}
-
}
static void
" -mlink-relax generate relocations for linker relaxation (default).\n"
" -mno-link-relax don't generate relocations for linker relaxation.\n"
));
-
}
/* This function is called once, at assembler startup time.
switch (imm_expr->X_op)
{
case O_constant:
- values[num++] = (insn_t) imm_expr->X_add_number;
+ values[num++] = imm_expr->X_add_number;
break;
case O_big:
/* Extract lower 32-bits of a big number.
Assume that generic_bignum_to_int32 work on such number. */
- values[num++] = (insn_t) generic_bignum_to_int32 ();
+ values[num++] = generic_bignum_to_int32 ();
break;
default:
/* The first value isn't constant, so it should be
gas_assert (mode == expr_normal);
regno = reg_lookup_internal (name, RCLASS_GPR);
- if (regno == (unsigned int)-1)
+ if (regno == -1u)
return false;
if (symbol_find (name) != NULL)
}
else if (lex_reg_name (REG_BIT_Dn, ®2))
{
- if (c >= -1 * (long) (0x1u << 17)
- &&
- c < (long) (0x1u << 17) - 1)
+ if (c >= -1 * (1L << 17) && c < (1L << 17) - 1)
{
*n_bytes = 3;
*xb = 0x80;
{
if (operand->flags & S390_OPERAND_PCREL)
{
- val = (offsetT) ((addressT) val << 1);
- min = (offsetT) ((addressT) min << 1);
- max = (offsetT) ((addressT) max << 1);
+ val = (addressT) val << 1;
+ min = (addressT) min << 1;
+ max = (addressT) max << 1;
}
s390_bad_operand_out_of_range (operand_number, val, min, max,
return;
}
/* val is ok, now restrict it to operand->bits bits. */
- uval = (addressT) val & ((((addressT) 1 << (operand->bits-1)) << 1) - 1);
+ uval = val & ((((addressT) 1 << (operand->bits-1)) << 1) - 1);
/* val is restrict, now check for special case. */
if (operand->bits == 20 && operand->shift == 20)
uval = (uval >> 12) | ((uval & 0xfff) << 8);
addressT min, max;
max = (((addressT) 1 << (operand->bits - 1)) << 1) - 1;
- min = (offsetT) 0;
- uval = (addressT) val;
+ min = 0;
+ uval = val;
/* Vector register operands have an additional bit in the RXB
field. */
sprintf (s3_err_msg,
_("invalid constant: %d bit expression not in range %u..%u"),
s3_score_df_range[data_type].bits,
- 0, (unsigned)0xffffffff);
+ 0, 0xffffffff);
}
else if (data_type == _IMM5_MULTI_LOAD)
{
var_num = 1;
/* Fix part
For an external symbol: addi rD, <constant> */
- sprintf (tmp, "addi r%d, %d", reg_rd, (int)add_number);
+ sprintf (tmp, "addi r%d, %d", reg_rd, (int) add_number);
if (s3_append_insn (tmp, false) == s3_FAIL)
return;
{
return 1;
}
- else if ((!S_IS_DEFINED (sym) || S_IS_COMMON (sym)) && (0
- /* We must defer this decision until after the whole file has been read,
- since there might be a .extern after the first use of this symbol. */
- || (before_relaxing
- && S_GET_VALUE (sym) == 0)
- || (S_GET_VALUE (sym) != 0
- && S_GET_VALUE (sym) <= s3_g_switch_value)))
+ else if ((!S_IS_DEFINED (sym) || S_IS_COMMON (sym))
+ && (0
+ /* We must defer this decision until after the
+ whole file has been read, since there might be a
+ .extern after the first use of this symbol. */
+ || (before_relaxing
+ && S_GET_VALUE (sym) == 0)
+ || (S_GET_VALUE (sym) != 0
+ && S_GET_VALUE (sym) <= s3_g_switch_value)))
{
return 0;
}
symbolS *p;
c = get_symbol_name (&name);
- p = (symbolS *) symbol_find_or_make (name);
+ p = symbol_find_or_make (name);
(void) restore_line_pointer (c);
return p;
}
s3_build_dependency_insn_hsh ();
- for (i = (int)s3_REG_TYPE_FIRST; i < (int)s3_REG_TYPE_MAX; i++)
+ for (i = s3_REG_TYPE_FIRST; i < s3_REG_TYPE_MAX; i++)
s3_build_reg_hsh (s3_all_reg_maps + i);
/* Initialize dependency vector. */
if (s == NULL)
frag_addr = 0;
else
- symbol_address = (addressT) symbol_get_frag (s)->fr_address;
+ symbol_address = symbol_get_frag (s)->fr_address;
inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN16_SIZE);
offset = (inst_value & 0x1ff) << 1;
if (s == NULL)
frag_addr = 0;
else
- symbol_address = (addressT) symbol_get_frag (s)->fr_address;
+ symbol_address = symbol_get_frag (s)->fr_address;
inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN_SIZE);
offset = (inst_value & 0x1)
if (s == NULL)
frag_addr = 0;
else
- symbol_address = (addressT) symbol_get_frag (s)->fr_address;
+ symbol_address = symbol_get_frag (s)->fr_address;
value = s7_md_chars_to_number (fragp->fr_literal, s7_INSN_SIZE);
symbolS *p;
c = get_symbol_name (&name);
- p = (symbolS *) symbol_find_or_make (name);
+ p = symbol_find_or_make (name);
(void) restore_line_pointer (c);
return p;
}
s7_build_dependency_insn_hsh ();
- for (i = (int) REG_TYPE_FIRST; i < (int) s7_REG_TYPE_MAX; i++)
+ for (i = REG_TYPE_FIRST; i < s7_REG_TYPE_MAX; i++)
s7_build_reg_hsh (s7_all_reg_maps + i);
/* Initialize dependency vector. */
if (val >= 0)
val >>= shift;
else
- val = ((val >> shift)
- | ((long) -1 & ~ ((long) -1 >> shift)));
+ val = (val >> shift) | (-1L & ~ (-1L >> shift));
}
/* Extend sign for 64-bit host. */
&& (the_insn.exp.X_add_number < -(offsetT) U0x80000000
|| the_insn.exp.X_add_number > (offsetT) U0xffffffff))
as_warn (_("set: number not in -2147483648..4294967295 range"));
- the_insn.exp.X_add_number = (int) the_insn.exp.X_add_number;
+ the_insn.exp.X_add_number = (int32_t) the_insn.exp.X_add_number;
}
}
current_op->immediate.s_number
= current_op->immediate.imm_expr.X_add_number;
current_op->immediate.u_number
- = (unsigned int) current_op->immediate.imm_expr.X_add_number;
+ = current_op->immediate.imm_expr.X_add_number;
current_op->immediate.resolved = 1;
}
}
current_op->immediate.decimal_found = 1;
current_op->immediate.label = xstrdup (token);
current_op->immediate.f_number = (float) atof (token);
- current_op->immediate.s_number = (int) atoi (token);
- current_op->immediate.u_number = (unsigned int) atoi (token);
+ current_op->immediate.s_number = atoi (token);
+ current_op->immediate.u_number = atoi (token);
current_op->immediate.resolved = 1;
}
current_op->op_type = Disp | Abs24 | Imm16 | Imm24;
if (mant == 0)
{
mant |= 0x00800000;
- exp = (long) exp - 0x01000000;
+ exp = exp - 0x01000000;
}
}
tmsfloat = exp | mant;
char c;
char *name;
char *p;
- int words;
+ offsetT words;
segT current_seg;
subsegT current_subseg;
symbolS *symbolP;
words = get_absolute_expression ();
if (words < 0)
{
- as_bad (_(".bss size %d < 0!"), words);
+ as_bad (_(".bss size %d < 0!"), (int) words);
ignore_rest_of_line ();
return;
}
static void
tic54x_struct_field (int type)
{
- int size;
+ unsigned int size;
int count = 1;
int new_bitfield_offset = 0;
int field_align = current_stag->current_bitfield_offset != 0;
if (current_stag->is_union)
{
/* Note we treat the element as if it were an array of COUNT. */
- if (current_stag->size < (unsigned) size * count)
+ if (current_stag->size < size * count)
current_stag->size = size * count;
}
else
{
- abs_section_offset += (unsigned) size * count;
+ abs_section_offset += size * count;
current_stag->current_bitfield_offset = new_bitfield_offset;
}
line_label = NULL;
/* OR in existing value. */
if (alloc_frag->tc_frag_data)
- value |= ((unsigned short) p[1] << 8) | p[0];
+ value |= ((uint16_t) p[1] << 8) | p[0];
md_number_to_chars (p, value, 2);
alloc_frag->tc_frag_data += size;
if (alloc_frag->tc_frag_data == 16)
if (strcasecmp (operand->buf, "st0") == 0
|| strcasecmp (operand->buf, "st1") == 0)
{
- insn->opcode[0].word |=
- ((unsigned short) (operand->buf[2] - '0')) << 9;
+ insn->opcode[0].word |= ((uint16_t) (operand->buf[2] - '0')) << 9;
return 1;
}
else if (operand->exp.X_op == O_constant
&& (operand->exp.X_add_number == 0
|| operand->exp.X_add_number == 1))
{
- insn->opcode[0].word |=
- ((unsigned short) (operand->exp.X_add_number)) << 9;
+ insn->opcode[0].word |= ((uint16_t) (operand->exp.X_add_number)) << 9;
return 1;
}
as_bad (_("Invalid status register \"%s\""), operand->buf);
valueT value = bi->value;
value <<= available - size;
- value |= ((unsigned short) p[1] << 8) | p[0];
+ value |= ((uint16_t) p[1] << 8) | p[0];
md_number_to_chars (p, value, 2);
if ((prev_frag->tc_frag_data += size) == 16)
prev_frag->tc_frag_data = 0;
bool found_match = false;
for (i = 0; i < TIC6X_NUM_PREFER; i++)
- opc_rank[i] = (unsigned int) -1;
+ opc_rank[i] = -1u;
min_rank = TIC6X_NUM_PREFER - 1;
max_rank = 0;
if (rank > max_rank)
max_rank = rank;
- if (opc_rank[rank] == (unsigned int) -1)
+ if (opc_rank[rank] == -1u)
opc_rank[rank] = i;
else
/* The opcode table should provide a total ordering
{
fix_needed = false;
- if (opc_rank[try_rank] == (unsigned int) -1)
+ if (opc_rank[try_rank] == -1u)
continue;
opcode_value = tic6x_try_encode (opcm[opc_rank[try_rank]], operands,
&& (!S_IS_DEFINED (fixp->fx_addsy)
|| S_GET_SEGMENT (fixp->fx_addsy) != sec))
return 0;
- return (fixp->fx_where + fixp->fx_frag->fr_address) & ~(long) 0x1f;
+ return (fixp->fx_where + fixp->fx_frag->fr_address) & ~0x1fULL;
}
/* Round up a section size to the appropriate boundary. */
check_shift = 0;
/* Fall through. */
case O_hw0:
- ret = (signed short)num;
+ ret = (int16_t) num;
break;
case O_hw1_last:
check_shift = 16;
/* Fall through. */
case O_hw1:
- ret = (signed short)(num >> 16);
+ ret = (int16_t) (num >> 16);
break;
case O_hw2_last:
check_shift = 32;
/* Fall through. */
case O_hw2:
- ret = (signed short)(num >> 32);
+ ret = (int16_t) (num >> 32);
break;
case O_hw3:
- ret = (signed short)(num >> 48);
+ ret = (int16_t) (num >> 48);
break;
default:
/* Figure out what pipe the fnop must be in via arithmetic.
* p0 + p1 + p2 must sum to the sum of TILEGX_PIPELINE_Y[012]. */
current_bundle[0].pipe =
- (tilegx_pipeline)((TILEGX_PIPELINE_Y0
- + TILEGX_PIPELINE_Y1
- + TILEGX_PIPELINE_Y2) -
- (current_bundle[1].pipe + current_bundle[2].pipe));
+ (TILEGX_PIPELINE_Y0 + TILEGX_PIPELINE_Y1 + TILEGX_PIPELINE_Y2
+ - current_bundle[1].pipe - current_bundle[2].pipe);
}
check_illegal_reg_writes ();
switch (op)
{
case O_lo16:
- return (signed short)num;
+ return (int16_t) num;
case O_hi16:
- return (signed short)(num >> 16);
+ return (int16_t) (num >> 16);
case O_ha16:
- return (signed short)((num + 0x8000) >> 16);
+ return (int16_t) ((num + 0x8000) >> 16);
default:
abort ();
/* Figure out what pipe the fnop must be in via arithmetic.
* p0 + p1 + p2 must sum to the sum of TILEPRO_PIPELINE_Y[012]. */
current_bundle[0].pipe =
- (tilepro_pipeline)((TILEPRO_PIPELINE_Y0
- + TILEPRO_PIPELINE_Y1
- + TILEPRO_PIPELINE_Y2) -
- (current_bundle[1].pipe + current_bundle[2].pipe));
+ (TILEPRO_PIPELINE_Y0 + TILEPRO_PIPELINE_Y1 + TILEPRO_PIPELINE_Y2
+ - current_bundle[1].pipe - current_bundle[2].pipe);
}
check_illegal_reg_writes ();
if (f->fr_type == rs_align || f->fr_type == rs_align_code)
{
if (stretch < 0)
- stretch = - ((- stretch)
- & ~ ((1 << (int) f->fr_offset) - 1));
+ stretch = -(-stretch & ~((1ul << f->fr_offset) - 1));
else
- stretch &= ~ ((1 << (int) f->fr_offset) - 1);
+ stretch &= ~((1ul << f->fr_offset) - 1);
if (stretch == 0)
break;
}
default:
as_bad_where (fixP->fx_file, fixP->fx_line,
"bad or unhandled relocation type: 0x%02x",
- fixP->fx_r_type);
+ (unsigned int) fixP->fx_r_type);
break;
}
if (imm < 0 || imm > 31)
as_bad ("immediate value out of range");
- opcode |=
- (r1 << 10) | (r2 << 16) | (1 << 9) | ((imm & 0x1f) <<
- 4);
+ opcode |= ((r1 << 10) | (r2 << 16) | (1 << 9)
+ | ((imm & 0x1f) << 4));
}
else
{
if (finst < 0 || finst > 15)
as_bad ("finst out of range");
- opcode |=
- ((finst & 0xf) << 27) | (r1 << 10) | (r2 << 16) | (r3 <<
- 4);
+ opcode |= (((finst & 0xf) << 27)
+ | (r1 << 10) | (r2 << 16) | (r3 << 4));
}
else
{
if (finst < 0 || finst > 15)
as_bad ("finst out of range");
- opcode |=
- ((finst & 0xf) << 27) | (r1 << 10) | (r2 << 16) | (r3 <<
- 4);
+ opcode |= (((finst & 0xf) << 27)
+ | (r1 << 10) | (r2 << 16) | (r3 << 4));
}
else
{
}
-#define ERROR_REG_NUM ((unsigned) -1)
+#define ERROR_REG_NUM (-1u)
static unsigned
tc_get_register (const char *prefix)
case BFD_RELOC_HI16:
if (tok->X_op == O_constant)
{
- tok->X_add_number = ((unsigned) tok->X_add_number) >> 16;
+ tok->X_add_number = ((uint32_t) tok->X_add_number) >> 16;
return;
}
break;
#include "as.h"
#include "subsegs.h"
-dmp_frags ()
+void
+dmp_frags (void)
{
asection *s;
frchainS *chp;
}
}
-dmp_frag (fp, indent)
- struct frag *fp;
- char *indent;
+void
+dmp_frag (struct frag *fp, char *indent)
{
for (; fp; fp = fp->fr_next)
{
}
}
-var_chars (fp, n)
- struct frag *fp;
- int n;
+void
+var_chars (struct frag *fp, int n)
{
unsigned char *p;
else if (l->next->frag->fr_address + l->next->paddr
> l->frag->fr_address + l->paddr)
{
- count = ((l->next->frag->fr_address + l->next->paddr
- - (l->frag->fr_address + l->paddr))
- >> 2);
+ count = (l->next->frag->fr_address + l->next->paddr
+ - (l->frag->fr_address + l->paddr)) >> 2;
}
else
{
while (count > 0)
{
if (bufptr >= *bufend)
- bufptr = ecoff_add_bytes (buf, bufend, bufptr, (long) 1);
+ bufptr = ecoff_add_bytes (buf, bufend, bufptr, 1);
/* 1 is added to each count read. */
--count;
if (count > 0x0f)
int loc4_fix, ca;
loc4_frag = (fragS *) frag->fr_opcode;
- loc4_fix = (int) frag->fr_offset;
+ loc4_fix = frag->fr_offset;
diff = resolve_symbol_value (frag->fr_symbol);
symbol_get_frag (right.X_add_symbol),
&frag_off))
{
- offsetT symval_diff = S_GET_VALUE (resultP->X_add_symbol)
- - S_GET_VALUE (right.X_add_symbol);
+ offsetT symval_diff = (S_GET_VALUE (resultP->X_add_symbol)
+ - S_GET_VALUE (right.X_add_symbol));
subtract_from_result (resultP, right.X_add_number, right.X_extrabit);
subtract_from_result (resultP, frag_off / OCTETS_PER_BYTE, 0);
add_to_result (resultP, symval_diff, symval_diff < 0);
partial_size = limit - p;
/* Save the fragment after that last newline. */
- memcpy (save_source, partial_where, (int) AFTER_SIZE);
- memcpy (partial_where, AFTER_STRING, (int) AFTER_SIZE);
+ memcpy (save_source, partial_where, AFTER_SIZE);
+ memcpy (partial_where, AFTER_STRING, AFTER_SIZE);
return partial_where;
read_more:
{
size_t data_buffer_size;
list_info_type *first = list;
- unsigned int address = ~(unsigned int) 0;
+ unsigned int address = ~0u;
fragS *frag;
fragS *frag_ptr;
unsigned int octet_in_frag;
while (octet_in_frag < frag_ptr->fr_fix
&& data_buffer_size < MAX_BYTES - 3)
{
- if (address == ~(unsigned int) 0)
+ if (address == ~0u)
address = frag_ptr->fr_address / OCTETS_PER_BYTE;
sprintf (data_buffer + data_buffer_size,
< frag_ptr->fr_fix + frag_ptr->fr_var * frag_ptr->fr_offset)
&& data_buffer_size < MAX_BYTES - 3)
{
- if (address == ~(unsigned int) 0)
+ if (address == ~0u)
address = frag_ptr->fr_address / OCTETS_PER_BYTE;
sprintf (data_buffer + data_buffer_size,
nchars = (LISTING_WORD_SIZE * 2 + 1) * listing_lhs_width;
/* Print the hex for the first line. */
- if (address == ~(unsigned int) 0)
+ if (address == ~0u)
{
fprintf (list_file, "% 4d ", lineno);
for (idx = 0; idx < nchars; idx++)
p = buffer_line (list->file, buffer, width);
if (list->file->linenum < list_line)
- address = ~(unsigned int) 0;
+ address = ~0u;
else
address = calc_hex (list);
}
static void
-print_single_option (char * opt, int *pos)
+print_single_option (char *opt, size_t *pos)
{
size_t opt_len = strlen (opt);
- if ((*pos + opt_len) < paper_width)
+ if (*pos + opt_len < paper_width)
{
fprintf (list_file, _("%s "), opt);
*pos = *pos + opt_len;
print_options (char ** argv)
{
const char *field_name = _("\n options passed\t: ");
- int pos = strlen (field_name);
+ size_t pos = strlen (field_name);
char **p;
fputs (field_name, list_file);
{
size_t count;
- count = (size_t) get_absolute_expression ();
+ count = get_absolute_expression ();
do_repeat (count, "REPT", "ENDR", expand_count ? "" : NULL);
}
/* We can ignore any carry out, because it will be handled by
extra_digit if it is needed. */
- extra_digit = (valueT) -1;
+ extra_digit = -1;
op = O_big;
}
/* Let check_eh_frame know that data is being emitted. nbytes == -1 is
a signal that this is leb128 data. It shouldn't optimize this away. */
- nbytes = (unsigned int) -1;
+ nbytes = -1u;
if (check_eh_frame (exp, &nbytes))
abort ();
get_absolute_expression_and_terminator (long *val_pointer /* Return value of expression. */)
{
/* FIXME: val_pointer should probably be offsetT *. */
- *val_pointer = (long) get_absolute_expression ();
+ *val_pointer = get_absolute_expression ();
return (*input_line_pointer++);
}
\f
ignore_rest_of_line ();
}
*lenP = len;
- return (retval);
+ return retval;
}
\f
/* In: Input_line_pointer->next character.
symbol_table_insert (symbolP);
} /* if symbol wasn't found */
- return (symbolP);
+ return symbolP;
}
symbolS *
if (!symbolP)
symbolP = symbol_new (name, undefined_section, &zero_address_frag, 0);
- return (symbolP);
+ return symbolP;
}
symbolS *
S_GET_NAME (s));
}
}
- return (valueT) s->x->value.X_add_number;
+ return s->x->value.X_add_number;
}
valueT
size = 0;
flags = bfd_section_flags (sec);
- if (size == 0 && bfd_section_size (sec) != 0 &&
- (flags & SEC_HAS_CONTENTS) != 0)
+ if (size == 0 && bfd_section_size (sec) != 0
+ && (flags & SEC_HAS_CONTENTS) != 0)
return;
if (size > 0 && ! seginfo->bss)