File: iso9660.h

package info (click to toggle)
util-linux 2.36.1-8%2Bdeb11u2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 50,684 kB
  • sloc: ansic: 135,480; sh: 16,120; yacc: 1,171; makefile: 407; xml: 389; python: 316; csh: 37; sed: 16; perl: 15
file content (58 lines) | stat: -rw-r--r-- 1,091 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef UTIL_LINUX_ISO_H
#define UTIL_LINUX_ISO_H

#include <stdbool.h>

#include "c.h"

static inline int isonum_721(unsigned char *p)
{
	return ((p[0] & 0xff)
		| ((p[1] & 0xff) << 8));
}

static inline int isonum_722(unsigned char *p)
{
	return ((p[1] & 0xff)
		| ((p[0] & 0xff) << 8));
}

static inline int isonum_723(unsigned char *p, bool check_match)
{
	int le = isonum_721(p);
	int 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 int isonum_731(unsigned char *p)
{
	return ((p[0] & 0xff)
		| ((p[1] & 0xff) << 8)
		| ((p[2] & 0xff) << 16)
		| ((p[3] & 0xff) << 24));
}

static inline int isonum_732(unsigned char *p)
{
	return ((p[3] & 0xff)
		| ((p[2] & 0xff) << 8)
		| ((p[1] & 0xff) << 16)
		| ((p[0] & 0xff) << 24));
}

static inline int isonum_733(unsigned char *p, bool check_match)
{
	int le = isonum_731(p);
	int be = isonum_732(p + 4);

	if (check_match && le != be)
		/* translation is useless */
		warnx("733error: le=%d be=%d", le, be);
	return(le);
}

#endif