Why is Math.DivRem so inefficient?

后端 未结 11 1944
慢半拍i
慢半拍i 2020-12-08 18:59

In my computer this code takes 17 seconds (1000 millions times):

static void Main(string[] args) {
   var sw = new Stopwatch(); sw.Start();
   int r;
   for          


        
11条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 19:34

    Grrr. The only reason for this function to exist is to take advantage of the CPU instruction for this, and they didn't even do it!

提交回复
热议问题