gpt4 book ai didi

python - 如何在numpy中将2个uint32连接到int64

转载 作者:太空宇宙 更新时间:2023-11-04 01:28:22 25 4
gpt4 key购买 nike

我有一对 numpy uint32,每个都是 uint64 的一半。如何轻松连接它们?

我有类似的东西

w = np.uint32(775329792) 
x = np.uint32(46919588)

wx = np.uint64(?)

最佳答案

您可以使用 bitshift运算符(operator)

wx = (w << 32) + x;

上面使用 w 作为最高有效 32 位,然后添加 x 作为最低有效 32 位。

关于python - 如何在numpy中将2个uint32连接到int64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15900820/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com