You might recognise that from this FAQ. It is part of a bit of code to list the permission settings on a given file under a *nix type system.Code:putchar("rwx"[i % 3]);
Now I implemented some code that was not as pretty - it basically was a string of 9 if statements (for the permission bits) which assigned the appropriate char to an array of char. Then I could print the string out when needed.
As I was mentally comparing these two ways of printing the permission bits of a file, I was wondering how expensive it would be to use modulus like that in a loop. Would it ever make a noticeable difference, or is it something not worth worrying about?