The previous code is correct, but hard to verify: The libmpdec documentation
rightfully states that an mpd_t with a coefficient flagged as MPD_CONST_DATA must not be in the position of the result operand. In this particular case several assumptions guarantee that a resize will never occur in all possible code paths, which was the reason for using MPD_CONST_DATA and saving an instruction by omitting the initialization of tmp.alloc. For readability, tmp is now flagged as MPD_STATIC_DATA and tmp.alloc is initialized.
Showing
Please register or sign in to comment