3 ms·
It seems a little funny to say you can't use multiplication or division operators, but then use shift operators to do multiplication and division. Also, the sug
by sgtnoodle 4y ago
It seems a little funny to say you can't use multiplication or division operators, but then use shift operators to do multiplication and division. Also, the suggested solution uses a `*` in the final return...
It seems like you could instead use addition of a value with itself for the multiplication by 2, and it seems like there isn't any inherent need to divide by 2.
Here's my submission (set to expire after a month).
https://pastebin.com/mgvGakLL https://pastebin.com/mgvGakLL
- onos 4y agoHere’s another as valid as given in the post. A/ b = exp(log(a) - log(b)) No multiplication or division!
- whatshisface 4y agoI think the implied context is "you're only allowed to use instructions that involve simpler circuitry than multiplication or division." Otherwise there's no point in asking the question.
- orlp 4y agoThis is actually a common implementation for multiplication in the finite field GF(8), using 2x256 byte exp/log lookup tables.
- deleted 4y ago[deleted]