aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfd-in2.h
diff options
context:
space:
mode:
authorJohn Darrington <john@darrington.wattle.id.au>2018-07-24 12:58:43 +0200
committerAlan Modra <amodra@gmail.com>2018-07-27 11:28:59 +0930
commit370e4b5079ff8d62be3adee7396948d4c5795091 (patch)
tree6cddc1bcfede5c1a64562cca7e5396dcd25c3c42 /bfd/bfd-in2.h
parentcd4d353f812a3ecb29cabf0e62319253daf510fa (diff)
downloadbinutils-370e4b5079ff8d62be3adee7396948d4c5795091.zip
binutils-370e4b5079ff8d62be3adee7396948d4c5795091.tar.gz
binutils-370e4b5079ff8d62be3adee7396948d4c5795091.tar.bz2
Add functions and macros to read and write 24 bit values.
* libbfd.c (bfd_getb24, bfd_getl24): New functions. (bfd_get_24, bfd_put_24): New macros. * bfd-in2.h: Regenerate.
Diffstat (limited to 'bfd/bfd-in2.h')
-rw-r--r--bfd/bfd-in2.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 3414682..414ca54 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1160,6 +1160,20 @@ char *bfd_follow_build_id_debuglink (bfd *abfd, const char *dir);
#define bfd_get_signed_16(abfd, ptr) \
BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
+#define bfd_put_24(abfd, val, ptr) \
+ do \
+ if (bfd_big_endian (abfd)) \
+ bfd_putb24 ((val), (ptr)); \
+ else \
+ bfd_putl24 ((val), (ptr)); \
+ while (0)
+
+bfd_vma bfd_getb24 (const void *p);
+bfd_vma bfd_getl24 (const void *p);
+
+#define bfd_get_24(abfd, ptr) \
+ (bfd_big_endian (abfd) ? bfd_getb24 (ptr) : bfd_getl24 (ptr))
+
#define bfd_put_32(abfd, val, ptr) \
BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
#define bfd_put_signed_32 \