ansalimit 2020-05-31 12:40 采纳率: 0%
浏览 3147
已结题

python3 :OverflowError Python int too large to convert to C long

OverflowError
Python int too large to convert to C long
File "H:\spinal code cloud\程序\spinal codes_ver3.7_an\A_Lookup3.py", line 17, in lookup3Init
lookup3array = np.array([0xdeadbeef + val] * 3, dtype=np.uint32)
File "H:\spinal code cloud\程序\spinal codes_ver3.7_an\A_Hash.py", line 29, in hash_func
hash_state = lookup3Init(s)
File "H:\spinal code cloud\程序\spinal codes_ver3.7_an\A_Encoder.py", line 80, in init
spine_value = hash_func(spine_value, block)
File "H:\spinal code cloud\程序\spinal codes_ver3.7_an\A_Spinal.py", line 82, in
encoder = Encoder(k, map_func, message)

    def lookup3Init(val):

lookup3array = np.array([0xdeadbeef + val] * 3, dtype=np.uint32) #这里有问题
lookup3list = list(lookup3array)

return lookup3list



    def lookup3Update(state, data):

def rot(x,k):

    return (((x) << (k)) | ((x) >> (32-(k))))  # 

state[1] += data
state[2] ^= state[1]    #这里有问题
state[2] -= rot(state[1],14)
state[0] ^= state[2]
state[0] -= rot(state[2],11)
state[1] ^= state[0]
state[1] -= rot(state[0],25)
state[2] ^= state[1]
state[2] -= rot(state[1],16)
state[0] ^= state[2]
state[0] -= rot(state[2],4)
state[1] ^= state[0]
state[1] -= rot(state[0],14)
state[2] ^= state[1]
state[2] -= rot(state[1],24)

return state
  • 写回答

2条回答 默认 最新

  • threenewbee 2020-05-31 13:27
    关注

    state[2] ^= state[1]

    state[1] * state[2]的值太大,超过了int可以表示的范围

    评论

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样