That appears to be a direct C++ translation of item 175 from HAKMEM [1]. This does not require a division and can be done much faster, see section 1.24 of [2].
[1] http://www.inwap.com/pdp10/hbaker/hakmem/hacks.html#item175
[1] http://www.inwap.com/pdp10/hbaker/hakmem/hacks.html#item175
From the link:
IDIVM D,C