Skip to content

Error comment on bit twiddling trick #33

@Kingfish404

Description

@Kingfish404

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.

Metadata

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