Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Incorrect xxx_rshift32_rounded primitive in audio utility/dspinst.h

  1. #1
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,456

    Incorrect xxx_rshift32_rounded primitive in audio utility/dspinst.h

    The correct logic for these would be (value + (1<<31)) >> 32, but the constant for
    1<<31 was incorrectly set at 0x8000000 (which is 1<<27) rather than 0x80000000...

    Pull-request:
    https://github.com/PaulStoffregen/Audio/pull/426

    - note there is one place in the file using 0x8000000 that is valid and nothing to do with rounding -

    Discussion from post #11 here:
    https://forum.pjrc.com/threads/68660...hift32_rounded

  2. #2
    Senior Member
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    247
    Just curious … given the nature of the original error, why not edit in (1<<31) wherever it was needed, or even #define ROUND_VALUE (1<<31) and use that? Future generations might thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •