It's common for an folding operation to apply to both the 32-bit and 64-bit variant of the same opcode, which leads to checking which kind of result we need to store the value as. This moves it to its own function, so that we don't need to duplicate it in various functions.