Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,865
    • Issues 4,865
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 461
    • Merge requests 461
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #21218
Closed
Open
Created Mar 10, 2022 by Simon Jakobi@sjakobiDeveloper

Documentation on instance Bits Integer should be improved

This instance is pretty special:

  • Most bit operations pretend to operate on a "fake 2's complement" form, despite this note in the Integer haddocks:

    Integers are stored in a kind of sign-magnitude form, hence do not expect two's complement form when using bit operations.

  • However popCount does not use the fake 2's complement form and instead returns negative results for negative Integers.

  • rotate = shift

  • The conversion from and to the fake 2's complement form incurs extra overhead for bit operations on negative numbers.

I think it would be good to document this in the haddocks of the Bits instance, and to remove or fix the note in the Integer haddocks.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking