Correct the C implementation for MultiU16X8toH16
The comment behind the ASM MultiU16X8toH16 was misleading. It actually computes ((a<<8)*b)>>16, or (a*b)>>8. Correct the comment and C reference implementation accordingly.
This commit is contained in:
parent
710852a1f2
commit
31b913cddb
1 changed files with 2 additions and 2 deletions
|
@ -8,7 +8,7 @@ extern const uint16_t speed_lookuptable_slow[256][2] PROGMEM;
|
|||
|
||||
#ifndef _NO_ASM
|
||||
|
||||
// intRes = intIn1 * intIn2 >> 16
|
||||
// intRes = intIn1 * intIn2 >> 8
|
||||
// uses:
|
||||
// r26 to store 0
|
||||
// r27 to store the byte 1 of the 24 bit result
|
||||
|
@ -82,7 +82,7 @@ asm volatile ( \
|
|||
|
||||
static inline void MultiU16X8toH16(uint16_t& intRes, uint8_t& charIn1, uint16_t& intIn2)
|
||||
{
|
||||
intRes = ((uint32_t)charIn1 * (uint32_t)intIn2) >> 16;
|
||||
intRes = ((uint32_t)charIn1 * (uint32_t)intIn2) >> 8;
|
||||
}
|
||||
|
||||
static inline void MultiU24X24toH16(uint16_t& intRes, uint32_t& longIn1, uint32_t& longIn2)
|
||||
|
|
Loading…
Reference in a new issue