Visual C ++中固有的128位除法 [英] 128-bit division intrinsic in Visual C++
问题描述
我想知道Visual C ++中是否真的没有128位除法内在函数?
I'm wondering if there really is no 128-bit division intrinsic function in Visual C++?
有一个称为_umul128()
的64x64 = 128位乘法内在函数,与MUL
x64汇编程序指令很好地匹配.
There is a 64x64=128 bit multiplication intrinsic function called _umul128()
, which nicely matches the MUL
x64 assembler instruction.
自然地,我假设也将有一个内在的128/64 = 64位划分(对DIV
指令进行建模),但是令我惊讶的是,Visual C ++和Intel C ++似乎都没有,至少没有列出在intrin.h中.
Naturally, I assumed there would be a 128/64=64 bit division intrinsic as well (modelling the DIV
instruction), but to my amazement neither Visual C++ nor Intel C++ seem to have it, at least it's not listed in intrin.h.
有人可以确认吗?我尝试对编译器可执行文件中的函数名称进行grep'ing操作,但首先找不到_umul128
,所以我想我找错了位置.
Can someone confirm that? I tried grep'ing for the function names in the compiler executable files, but couldn't find _umul128
in the first place, so I guess I looked in the wrong spot.
更新:至少我现在在Visual C ++ 2010的c1.dll中找到了模式umul128
(不带下划线).所有其他内在函数都在其周围列出,但不幸的是,没有"udiv128"之类的内容: (因此,似乎他们真的已经忘记了"实现它.
Update: at least I have now found the pattern umul128
(without the leading underscore) in c1.dll of Visual C++ 2010. All the other intrinsics are listed around it, but unfortunately no "udiv128" or the like :( So it seems they really have "forgotten" to implement it.
要澄清一下:我不仅在寻找128位数据类型,而且还在寻找一种用C ++将128位标量int除以64位int的方法. 固有函数或 native 128位整数支持都可以解决我的问题.
To clarify: I'm not only looking for a 128-bit data type, but a way to divide a 128-bit scalar int by a 64-bit int in C++. Either an intrinsic function or native 128-bit integer support would solve my problem.
答案是否定的,直到2017年为止Visual Studio 2010中都没有内在的_udiv128
,但是在Visual Studio 2019 RTM中可用.
The answer is no, there is no _udiv128
intrinsic in Visual Studio 2010 up to 2017, but it is available in Visual Studio 2019 RTM
推荐答案
我不是专家,但我对此进行了挖掘:
I am no expert, but I dug this up:
http://research.swtch.com/2008/01/Division-via-multiplication.html
有趣的东西.希望对您有所帮助.
Interesting stuff. Hope it helps.
这也很有见地: http://www.gamedev. net/topic/508197-x64-div-intrinsic/
这篇关于Visual C ++中固有的128位除法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!