Skip to content
Snippets Groups Projects

Avoid undefined shifting of negative number in rate.c.

Merged Petter Reinholdtsen requested to merge rate-q57-negative-64 into master

It is undefined what left-shifting a negative number should do, and the compiler do not like trying to shift the -64 value 57 bits to the left.

Changed the definition of OC_Q57() to left shift one bit and use multiplication, to change the operatoin to a well defined one. Patch from Timothy B_ Terriberry.

This get rid of this clang message:

../../lib/rate.c:746:15: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
    log_scale=OC_Q57(-64);
              ^~~~~~~~~~~
../../lib/mathops.h:134:38: note: expanded from macro 'OC_Q57'
#define OC_Q57(_v) ((ogg_int64_t)(_v)<<57)
                    ~~~~~~~~~~~~~~~~~^

Fixes #2321 (closed)

Edited by Petter Reinholdtsen

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading