UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

取消
显示结果 
搜索替代 
您的意思是: 
177 次查看
注册日期: ‎11-27-2018

int512等任意精度类型如何获取和设置固定的第几位二进制值

   要获取int512的第500位二进制值,通过左移等位操作实现,发现移位超过32或16位时有问题。有没有大神知道该如何解决?

 

0 项奖励
1 条回复1
Xilinx Employee
Xilinx Employee
136 次查看
注册日期: ‎07-16-2008

回复: int512等任意精度类型如何获取和设置固定的第几位二进制值

可以试试apint_get_bit操作。请参考UG902,第620页。

#include "ap_cint.h"

int512 var;

int res;

res = apint_get_bit(var,499);

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------