libcdio-paranoia 10.2+2.0.2
lib/cdda_interface/utils.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org>
3 Copyright (C) 2014 Robert Kausch <robert.kausch@freac.org>
4 Copyright (C) 1998 Monty xiphmont@mit.edu
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include <cdio/bytesex.h>
21#include <stdio.h>
22#include <time.h>
23
24/* I wonder how many alignment issues this is gonna trip in the
25 future... it shouldn't trip any... I guess we'll find out :) */
26
27static inline int
28bigendianp(void)
29{
30 int test=1;
31 char *hack=(char *)(&test);
32 if(hack[0])return(0);
33 return(1);
34}
35
36extern char *catstring(char *buff, const char *s);
37
38extern int gettime(struct timespec *);
39
40/*#if BYTE_ORDER == LITTLE_ENDIAN*/
41
42#ifndef WORDS_BIGENDIAN
43
44static inline int16_t be16_to_cpu(int16_t x){
45 return(UINT16_SWAP_LE_BE_C(x));
46}
47
48static inline int16_t le16_to_cpu(int16_t x){
49 return(x);
50}
51
52#else
53
54static inline int16_t be16_to_cpu(int16_t x){
55 return(x);
56}
57
58static inline int16_t le16_to_cpu(int16_t x){
59 return(UINT16_SWAP_LE_BE_C(x));
60}
61
62
63#endif
64
65static inline int16_t cpu_to_be16(int16_t x){
66 return(be16_to_cpu(x));
67}
68
69static inline int16_t cpu_to_le16(int16_t x){
70 return(le16_to_cpu(x));
71}
72
73void cderror(cdrom_drive_t *d, const char *s);
74
75void cdmessage(cdrom_drive_t *d,const char *s);
76
77void idperror(int messagedest, char **messages, const char *f, const char *s);
78
79void idmessage(int messagedest, char **messages, const char *f, const char *s);
80
void idmessage(int messagedest, char **messages, const char *f, const char *s)
Definition: utils.c:119
char * catstring(char *buff, const char *s)
Definition: utils.c:160
void cdmessage(cdrom_drive_t *d, const char *s)
Definition: utils.c:53
int gettime(struct timespec *)
Definition: utils.c:174
void idperror(int messagedest, char **messages, const char *f, const char *s)
Definition: utils.c:72
void cderror(cdrom_drive_t *d, const char *s)
Definition: utils.c:32
Structure for cdparanoia's CD-ROM access.
Definition: cdda.h:80