Division by a constant using shifts and adds/subtracts

后端 未结 3 1264
悲哀的现实
悲哀的现实 2020-12-17 05:36

Hi all I\'m trying to divide by an unsigned constant using only shifts and adds/subtracts - I have no problem with this if it were multiplication, but I\'m a bit stumped by

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-17 06:26

    i have developed a constant division generator that can easily give you optimized divisions by any constant. It follows the ideas from "Hacker's Delight".

    The tool named "kdiv" is available at sourceforge:

    http://sourceforge.net/projects/kdiv/

提交回复
热议问题