Write the shortest function you can that takes two binary-coded decimal integers and a character indicating an arithmetic operation to perform and return the result.
You will be passed two 32-bit bit patterns representing unsigned BCD integers. In C or Java, for example, you would be passed an
unsigned, if you prefer). The third argument to your function will be a single character denoting what operation to perform. If your language requires fixed return sizes, return a 32-bit result and ignore overflow. Your return value should also be encoded as a BCD.
You should support
%. For subtraction, the first argument is the minuend and the second argument is the subtrahend. For division and modulo, the first argument is the quotient and the second is the divisor.
bcd(0x00000127, 0x00000003, '+') => 0x00000130 // NOT 0x0000012A