Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • LilyPond LilyPond
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1,023
    • Issues 1,023
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 14
    • Merge requests 14
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • LilyPond
  • LilyPondLilyPond
  • Merge requests
  • !971

Fix CSS-style #rrggbbaa colors

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Jean Abou Samra requested to merge jeanas/lilypond:fix-css-colors into master Oct 21, 2021
  • Overview 8
  • Commits 1
  • Pipelines 5
  • Changes 2

This code was shifting by 8 bits (multiplying by 256) instead of 4 (to multiply by 16). In addition, C and C++ apparently have weird promotion rules regarding bitwise operations [1], which got us into oddity and undefined behavior territory (I have not investigated what precisely). Another problem was the division by 256.0, which is incorrect because mapping the range [0, 255] to [0, 1] requires dividing by 255.0.

Fix this by replacing the expression with a simple and correct arithmetic operation where typing is clear.

[1] https://wiki.sei.cmu.edu/confluence/display/c/EXP14-C.+Beware+of+integer+promotion+when+performing+bitwise+operations+on+integer+types+smaller+than+int

Closes #6200 (closed)

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: fix-css-colors