gnu@sun.uucp (John Gilmore) (01/12/84)
With all this talk about division, I'd like to see modulo addressed. I looked at compiling "hacker division" last month and came up with the code already described, but could not come up with reasonable code for doing "hacker modulo" (given the "Fortran" definition of modulo). For those who joined late, we're talking about dividing by powers of two, by shifting -- you have to correct it if the argument is negative. For modulo by powers of two, of course, you just want to AND to keep the low order bits, but again a correction is required for negatives -- one which was not obvious to me except to brute force it, which generates lousy code.