1 #ifndef RBCODECPLATFORM_H_INCLUDED
2 #define RBCODECPLATFORM_H_INCLUDED
7 /* O_RDONLY, O_WRONLY, O_CREAT, O_APPEND */
10 /* isdigit, islower, isprint, isspace, toupper */
13 /* memchr, memcmp, memcpy, memmove, memset, strcat, strchr, strcmp, strcpy,
14 * strlen, strncmp, strrchr */
20 /* abs, atoi, labs, rand */
26 #define swap16(x) bswap_16(x)
29 #define swap32(x) bswap_32(x)
32 /* hto{be,le}{16,32}, {be,le}toh{16,32}, ROCKBOX_{BIG,LITTLE}_ENDIAN */
35 #define betoh16 be16toh
38 #define betoh32 be32toh
41 #define letoh16 le16toh
44 #define letoh32 le32toh
46 #if BYTE_ORDER == LITTLE_ENDIAN
47 #define ROCKBOX_LITTLE_ENDIAN 1
49 #define ROCKBOX_BIG_ENDIAN 1
54 off_t
filesize(int fd
);
56 static inline off_t filesize(int fd) {
69 #define debugf(...) fprintf(stderr, __VA_ARGS__)
71 #define logf(...) do { fprintf(stderr, __VA_ARGS__); \
78 static inline bool tdspeed_alloc_buffers(int32_t **buffers
,
79 const int *buf_s
, int nbuf
)
82 for (i
= 0; i
< nbuf
; i
++)
84 buffers
[i
] = malloc(buf_s
[i
]);
91 static inline void tdspeed_free_buffers(int32_t **buffers
, int nbuf
)
94 for (i
= 0; i
< nbuf
; i
++)