Skip to content

Error comment on bit twiddling trick #33

Open
@Kingfish404

Description

x = (x | (x >> 16)); /* Set x=-1 if j&6=0, else x=0 */

should be

/* Set x=0xFFFFFFFFFFFFFFFF if x=0xFFFFFFFFFFFF0000, else x=0 */
// or
/* Set x=-1 if j%6=0, else x=0 */ 

It's clearly that the 2's complement of -1 is 0xFFFFFFFFFFFF0000 and there is no logic for j&6.

This Error has been copied or spread for so many repos.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions