找回密码
 欢迎注册
查看: 6274|回复: 2

[分享] Large Integer Functions

[复制链接]
发表于 2013-3-28 21:39:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?欢迎注册

×
Function
Description
Int32x32To64 Multiplies two signed 32-bit integers, returning a signed 64-bit integer result.
Int64ShllMod32 Performs a left logical shift operation on an unsigned 64-bit integer value. The function provides improved shifting code for left logical shifts where the shift count is in the range 0-31.
Int64ShraMod32 Performs a right arithmetic shift operation on a signed 64-bit integer value. The function provides improved shifting code for right arithmetic shifts where the shift count is in the range 0-31.
Int64ShrlMod32 Performs a right logical shift operation on an unsigned 64-bit integer value. The function provides improved shifting code for right logical shifts where the shift count is in the range 0-31.
MulDiv Multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value.
Multiply128 Multiplies two 64-bit integers to produce a 128-bit integer.
MultiplyExtract128 Multiplies two 64-bit integers to produce a 128-bit integer, shifts the product to the right by the specified number of bits, and returns the low 64 bits of the result.
MultiplyHigh Multiplies two 64-bit integers to produce a 128-bit integer and gets the high 64 bits.
PopulationCount64 Counts the number of one bits (population count) in a 64-bit unsigned integer.
ShiftLeft128 Shifts 128-bit left.
ShiftRight128 Shifts 128-bit right.
UInt32x32To64 Multiplies two unsigned 32-bit integers, returning an unsigned 64-bit integer result.
UnsignedMultiply128 Multiplies two unsigned 64-bit integers to produce an unsigned 128-bit integer.
UnsignedMultiplyExtract128 Multiplies two unsigned 64-bit integers to produce an unsigned 128-bit integer, shifts the product to the right by the specified number of bits, and returns the low 64 bits of the result.
UnsignedMulitplyHigh Multiplies two 64-bit integers to produce a 128-bit integer and gets the high unsigned 64 bits.
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
 楼主| 发表于 2013-3-28 21:55:16 | 显示全部楼层
最近在抽空阅读VS2012的文档,
发现VC2012里面添加了许多吸引人的新语法,
可以大大提升代码的优雅性,以及执行效率。

出于对大整数的计算比较关心,
偶尔在UInt32x32To64上按F1,
点开页面发现MS又新添了不少宏,
不过,很显然它们基本都是因为方便对应CPU新的指令集而出现的。
上面的表格来自:http://msdn.microsoft.com/zh-cn/ ... loads/aa383711.aspx
而奇怪的是,搜遍VS2012的本地帮助Mircosoft HelpViewer 2.0(与MSDN有什么区别?)也不曾有上述内容。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2013-3-28 23:58:58 | 显示全部楼层
强!$128bit$都出来了!

看来这个问题只要用$1$条指令就可以解决了:

http://bbs.emath.ac.cn/thread-4468-1-1.html
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

小黑屋|手机版|数学研发网 ( 苏ICP备07505100号 )

GMT+8, 2024-3-28 22:02 , Processed in 0.042689 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表