https://xcancel.com/NateSilver538/status/1853673781350260902

  • naom3 [she/her]
    ·
    18 days ago

    Modding by 2 is just a bitwise operation tho

    • plinky [he/him]
      ·
      edit-2
      18 days ago

      Gotta dump results in some accumulate tho, and if then logic might be eh (although with branch prediction it might be auto 2 threads actually soviet-hmm or similar utilization at least)

      • DaPorkchop_@lemmy.ml
        ·
        18 days ago

        A reasonable compiler could optimize this into a bitwise AND, load the pointer to the appropriate string constant into a register branchlessly using a lookup table or cmov instruction, and then execute a single call to printf.

        • plinky [he/him]
          ·
          edit-2
          18 days ago

          I mean if I want to know the precise number, like 40012 or whatever. Obviously single call is fast, but printf of 40000 strings single strings is meh. I mean in my variant I don’t run comparison, even bitwise, just 80000 rand and sum, single ceil and print