I am working on translating code from Python to Solidity and everything has worked up until this last loop. Cannot figure out where the difference is in the code (besides the bytes being in decimal and hex encodings). Follows is the code in both languages and the outputs.
Python
outmasks = bytes([12, 11, 12, 14, 23, 8, 9, 9, 7, 3, 6, 5, 19, 19, 6, 6, 4, 6, 6, 0, 9, 6, 13, 14, 19, 2, 7, 4, 0, 0, 0, 12, 23, 8, 8, 10, 6, 14, 14, 9, 4, 5, 6, 5, 20, 11, 12, 11])
for cnt in range(0x30):
outs |= outmasks[cnt] << 5*cnt
print(hex(outs))
0x5b174298a44b9c6521176000021c53734c9018c431a73298674a5177316c
Solidity
function test() public returns (bytes30 outs) {
bytes memory outmasks = hex"0c0b0c0e1708090907030605131306060406060009060d0e130207040000000c1708080a060e0e0904050605140b0c0b";
for (uint8 cnt = 0; cnt<48; cnt++) {
outs |= outmasks[cnt] << 5*cnt;
}
}
0x6c0000000000000000000000000000000000000000000000000000000000