开发者社区> 问答> 正文

python3 :OverflowError Python int too large to con

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

展开
收起
海边一只船 2020-05-31 17:43:31 1091 0
1 条回答
写回答
取消 提交回答
  • state[2] ^= state[1]
    state[1] * state[2]的值太大,超过了int可以表示的范围
    
    
    2020-05-31 17:43:45
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载