From cfe5e3905201349e9cf3f95d52ff4bd100bde37d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 21:10:49 +0200 Subject: Adding upstream version 2.39.3. Signed-off-by: Daniel Baumann --- include/iso9660.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 include/iso9660.h (limited to 'include/iso9660.h') diff --git a/include/iso9660.h b/include/iso9660.h new file mode 100644 index 0000000..437d6a8 --- /dev/null +++ b/include/iso9660.h @@ -0,0 +1,63 @@ +/* + * No copyright is claimed. This code is in the public domain; do with + * it what you wish. + */ +#ifndef UTIL_LINUX_ISO_H +#define UTIL_LINUX_ISO_H + +#include +#include + +#include "c.h" + +static inline uint16_t isonum_721(const unsigned char *p) +{ + return ((p[0] & 0xff) + | ((p[1] & 0xff) << 8)); +} + +static inline uint16_t isonum_722(const unsigned char *p) +{ + return ((p[1] & 0xff) + | ((p[0] & 0xff) << 8)); +} + +static inline uint16_t isonum_723(const unsigned char *p, bool check_match) +{ + uint16_t le = isonum_721(p); + uint16_t be = isonum_722(p + 2); + + if (check_match && le != be) + /* translation is useless */ + warnx("723error: le=%d be=%d", le, be); + return (le); +} + +static inline uint32_t isonum_731(const unsigned char *p) +{ + return ((p[0] & 0xff) + | ((p[1] & 0xff) << 8) + | ((p[2] & 0xff) << 16) + | (((uint32_t) p[3] & 0xff) << 24)); +} + +static inline uint32_t isonum_732(const unsigned char *p) +{ + return ((p[3] & 0xff) + | ((p[2] & 0xff) << 8) + | ((p[1] & 0xff) << 16) + | (((uint32_t) p[0] & 0xff) << 24)); +} + +static inline uint32_t isonum_733(const unsigned char *p, bool check_match) +{ + uint32_t le = isonum_731(p); + uint32_t be = isonum_732(p + 4); + + if (check_match && le != be) + /* translation is useless */ + warnx("733error: le=%d be=%d", le, be); + return(le); +} + +#endif -- cgit v1.2.3