aboutsummaryrefslogtreecommitdiff
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
commitaed80daedfb2895a386538f2e25bd6e00fb7935c (patch)
treefce9f1c96c2484309084f7902e7c80433d56d04a /opcodes/cgen-dis.c
parent3d855632912f4bbfbd6c27dc78c08f2d65e9b638 (diff)
downloadgdb-aed80daedfb2895a386538f2e25bd6e00fb7935c.zip
gdb-aed80daedfb2895a386538f2e25bd6e00fb7935c.tar.gz
gdb-aed80daedfb2895a386538f2e25bd6e00fb7935c.tar.bz2
* 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 f8598f1..0856d8f 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;