masarati@aero.polimi.it writes:
s/second/first/, but yes. With pdn=dn though (both args equal), the code first reset pdn->bv_val and then used that value. Swapping it makes more sense, and ensures that the output value is independent of whether or not pdn == dn.
Probably, the most appropriate fix consists in passing a temporary as the first argument.
No, the comment above the function says that pdn can be == dn.