Skip to content

Commit 9c763ba

Browse files
committed
Add ARM operations for 16-bit copy functions
1 parent ce2d6e9 commit 9c763ba

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

shared-module/audiomixer/Mixer.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,21 @@ static inline uint32_t pack8(uint32_t val) {
156156
}
157157

158158
static inline uint32_t copy16lsb(uint32_t val) {
159+
#if (defined(__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1))
160+
return __PKHBT(val, val, 16);
161+
#else
159162
val &= 0x0000ffff;
160163
return val | (val << 16);
164+
#endif;
161165
}
162166

163167
static inline uint32_t copy16msb(uint32_t val) {
168+
#if (defined(__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1))
169+
return __PKHTB(val, val, 16);
170+
#else
164171
val &= 0xffff0000;
165172
return val | (val >> 16);
173+
#endif;
166174
}
167175

168176
#define ALMOST_ONE (MICROPY_FLOAT_CONST(32767.) / 32768)

0 commit comments

Comments
 (0)