diff options
author | Thomas Perl <m@thp.io> | 2022-05-08 22:19:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 23:19:07 +0300 |
commit | 52271de4d7dbb11379cfc1b3dddc0a35852a06d8 (patch) | |
tree | 9a9033fb69d0a2afeefd4390629c73bb475f8079 /src/lib/endian_tools.h | |
parent | 03eac5e0aab558aeba465c886fce57c37f6f0c53 (diff) | |
download | atracdenc-52271de4d7dbb11379cfc1b3dddc0a35852a06d8.tar.gz |
Add support for writing .at3/.wav files with ATRAC3 (#30)
* Add support for writing .at3/.wav files with ATRAC3
* Check file size limit
* AT3/WAV export: Add big endian support, force packed structs
Diffstat (limited to 'src/lib/endian_tools.h')
-rw-r--r-- | src/lib/endian_tools.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/endian_tools.h b/src/lib/endian_tools.h index 519cca1..191b424 100644 --- a/src/lib/endian_tools.h +++ b/src/lib/endian_tools.h @@ -37,6 +37,22 @@ static inline uint16_t swapbyte16_on_le(uint16_t in) { #endif } +static inline uint32_t swapbyte32_on_be(uint32_t in) { +#ifdef BIGENDIAN_ORDER + return ((in & 0xff) << 24) | ((in & 0xff00) << 8) | ((in & 0xff0000) >> 8) | ((in & 0xff000000) >> 24); +#else + return in; +#endif +} + +static inline uint16_t swapbyte16_on_be(uint16_t in) { +#ifdef BIGENDIAN_ORDER + return ((in & 0xff) << 8) | ((in & 0xff00) >> 8); +#else + return in; +#endif +} + #ifdef __cplusplus static inline int16_t conv_ntoh(int16_t in) { @@ -57,4 +73,4 @@ static inline uint32_t conv_ntoh(uint32_t in) { #endif -#endif
\ No newline at end of file +#endif |