Very clever use of or instead of add. If there are no overlapping 1s, there is no carry, so or is equivalent to add in that case. Your gas golf is great! Also, I can see you have experience in branchless programming. I suppose it pays off in EVM assembly as well as x86-64 assembly?
0:00 - Code
8:16 - Demo
8:50 - Gas comparison
EVM playground
www.evm.codes/playground
Code
solidity-by-example.org/bitwise/
Take a course
www.smartcontract.engineer/
Thanks. More videos about assembly, yul or huff would be nice
Great vid!
Great info! Many thanks
Very clever use of or instead of add. If there are no overlapping 1s, there is no carry, so or is equivalent to add in that case. Your gas golf is great! Also, I can see you have experience in branchless programming. I suppose it pays off in EVM assembly as well as x86-64 assembly?
did not understand how u shift 4 by using shl(2, gt(x, 0xF) . if gt return 1 shl will be 2+1= 3 . isn't it ?
2