summaryrefslogtreecommitdiff
path: root/opcodes/cgen-dis.c
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2001-01-02 16:34:07 +0000
committerFrank Ch. Eigler <fche@redhat.com>2001-01-02 16:34:07 +0000
commit1aefe1f227596c5968c22f078abf90e2fc242a3b (patch)
tree8c9a0357f34e0016ce7235e9c0b220b1cfb2bab0 /opcodes/cgen-dis.c
parentab36474564e1553688fdbceb7f543fdd041d46d9 (diff)
downloadbinutils-redhat-1aefe1f227596c5968c22f078abf90e2fc242a3b.tar.gz
* generalization
2001-01-02 Richard Sandiford <rsandifo@redhat.com> * cgen-dis.c (hash_insn_array): Use bfd_put_bits(). (hash_insn_list): Likewise * cgen-ibld.in (insert_1): Use bfd_put_bits() and bfd_get_bits(). (extract_1): Use bfd_get_bits(). (extract_normal): Apply sign extension to both extraction methods. * cgen-opc.c (cgen_get_insn_value): Use bfd_get_bits() (cgen_put_insn_value): Use bfd_put_bits()
Diffstat (limited to 'opcodes/cgen-dis.c')
-rw-r--r--opcodes/cgen-dis.c50
1 files changed, 8 insertions, 42 deletions
diff --git a/opcodes/cgen-dis.c b/opcodes/cgen-dis.c
index f8598f1e33..0856d8f046 100644
--- a/opcodes/cgen-dis.c
+++ b/opcodes/cgen-dis.c
@@ -64,27 +64,10 @@ hash_insn_array (cd, insns, count, entsize, htable, hentbuf)
to hash on, so set both up. */
value = CGEN_INSN_BASE_VALUE (insn);
- switch (CGEN_INSN_MASK_BITSIZE (insn))
- {
- case 8:
- buf[0] = value;
- break;
- case 16:
- if (big_p)
- bfd_putb16 ((bfd_vma) value, buf);
- else
- bfd_putl16 ((bfd_vma) value, buf);
- break;
- case 32:
- if (big_p)
- bfd_putb32 ((bfd_vma) value, buf);
- else
- bfd_putl32 ((bfd_vma) value, buf);
- break;
- default:
- abort ();
- }
-
+ bfd_put_bits ((bfd_vma) value,
+ buf,
+ CGEN_INSN_MASK_BITSIZE (insn),
+ big_p);
hash = (* cd->dis_hash) (buf, value);
hentbuf->next = htable[hash];
hentbuf->insn = insn;
@@ -121,27 +104,10 @@ hash_insn_list (cd, insns, htable, hentbuf)
to hash on, so set both up. */
value = CGEN_INSN_BASE_VALUE (ilist->insn);
- switch (CGEN_INSN_MASK_BITSIZE (ilist->insn))
- {
- case 8:
- buf[0] = value;
- break;
- case 16:
- if (big_p)
- bfd_putb16 ((bfd_vma) value, buf);
- else
- bfd_putl16 ((bfd_vma) value, buf);
- break;
- case 32:
- if (big_p)
- bfd_putb32 ((bfd_vma) value, buf);
- else
- bfd_putl32 ((bfd_vma) value, buf);
- break;
- default:
- abort ();
- }
-
+ bfd_put_bits((bfd_vma) value,
+ buf,
+ CGEN_INSN_MASK_BITSIZE (ilist->insn),
+ big_p);
hash = (* cd->dis_hash) (buf, value);
hentbuf->next = htable [hash];
hentbuf->insn = ilist->insn;