Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by hinkley

6 months ago

    x |= x >> 1;
    x |= x >> 2;
    x |= x >> 4;
    x |= x >> 8;
    x |= x >> 16;
    x |= x >> 32;

Isn't there another way to do this without so many data races?

I feel like this should be

   x |= x >> 1 | x >> ??? ...

2 comments

hinkley

Reply

gpderetta  6 months ago

By data races I assume you actually mean data dependencies?

  • hinkley  6 months ago

    Oops. Yes.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities