I wanted to pop some zeros of a number without having to use division.(from 1000 to 10). I checked out the operand << and i know it's only for bit shifts but I was wondering if there is a way I can use shift in solidity to do that?
Asked
Active
Viewed 64 times
1 Answers
0
You can't.
Everything solidity can do efficiently maps directly to an ethereum EVM op code (listed here: evm.codes/). The only shift operations listed are for binary bits. If the goal is to save gas, then multiply or divide by ten inside an unchecked
block (but be sure you won't have issues with underflow and overflow).

Jeffrey
- 36
- 3