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.
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
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.
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