summaryrefslogtreecommitdiff
path: root/apps/codecs/aiff_enc.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-01-30 00:58:45 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-01-30 00:58:45 +0000
commit18770dac2e560c88daa3ca9944917be561c3548f (patch)
tree5adf8aef7cb7999a6e07ddefcbb9e1d9bf18a15c /apps/codecs/aiff_enc.c
parentc0c769c5a86c56c2ab2c9e88515a64da98575182 (diff)
downloadrockbox-18770dac2e560c88daa3ca9944917be561c3548f.tar.gz
rockbox-18770dac2e560c88daa3ca9944917be561c3548f.zip
Use __builtin_constant_p() to select the best byteswapping method: constant or target optimized. Same macro can then be used for constant values and inits as well as non-constant.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29171 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/aiff_enc.c')
-rw-r--r--apps/codecs/aiff_enc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/codecs/aiff_enc.c b/apps/codecs/aiff_enc.c
index cfbc95196f..2d55dff755 100644
--- a/apps/codecs/aiff_enc.c
+++ b/apps/codecs/aiff_enc.c
@@ -56,15 +56,15 @@ struct aiff_header aiff_header =
56 0, /* form_size (*) */ 56 0, /* form_size (*) */
57 { 'A', 'I', 'F', 'F' }, /* aiff_id */ 57 { 'A', 'I', 'F', 'F' }, /* aiff_id */
58 { 'C', 'O', 'M', 'M' }, /* comm_id */ 58 { 'C', 'O', 'M', 'M' }, /* comm_id */
59 H_TO_BE32(18), /* comm_size */ 59 htobe32(18), /* comm_size */
60 0, /* num_channels (*) */ 60 0, /* num_channels (*) */
61 0, /* num_sample_frames (*) */ 61 0, /* num_sample_frames (*) */
62 H_TO_BE16(PCM_DEPTH_BITS), /* sample_size */ 62 htobe16(PCM_DEPTH_BITS), /* sample_size */
63 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* sample_rate (*) */ 63 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* sample_rate (*) */
64 { 'S', 'S', 'N', 'D' }, /* ssnd_id */ 64 { 'S', 'S', 'N', 'D' }, /* ssnd_id */
65 0, /* ssnd_size (*) */ 65 0, /* ssnd_size (*) */
66 H_TO_BE32(0), /* offset */ 66 htobe32(0), /* offset */
67 H_TO_BE32(0), /* block_size */ 67 htobe32(0), /* block_size */
68}; 68};
69 69
70/* (*) updated when finalizing file */ 70/* (*) updated when finalizing file */
@@ -96,7 +96,10 @@ STATICIRAM void uint32_h_to_ieee754_extended_be(uint8_t f[10], uint32_t l)
96 f[1] = (uint8_t)exp; 96 f[1] = (uint8_t)exp;
97 /* mantissa is value left justified with most significant non-zero 97 /* mantissa is value left justified with most significant non-zero
98 bit stored in bit 63 - bits 0-63 */ 98 bit stored in bit 63 - bits 0-63 */
99 *(uint32_t *)&f[2] = htobe32(l); 99 f[2] = (uint8_t)(l >> 24);
100 f[3] = (uint8_t)(l >> 16);
101 f[4] = (uint8_t)(l >> 8);
102 f[5] = (uint8_t)(l >> 0);
100} /* uint32_h_to_ieee754_extended_be */ 103} /* uint32_h_to_ieee754_extended_be */
101 104
102/* called version often - inline */ 105/* called version often - inline */