修改 c 中的代码行以不包含无符号变量或强制转换。 (?)

Modify line of code in c to NOT contain unsigned variable or casting. (?)

如何在不使用 unsigned 标记的情况下修改 ANSI C 中的以下行?

unsigned int x, y, z; // unsigned variables should not be used
/*... some operations where x, y and z gets values between 0x0 and 0xFFFFFFFF ... */
x = (unsigned int)-(int)(y * z); // line to modify

您可以直接对无符号值应用否定。结果将以 2^N 为模减少,这就是您现有代码所做的。

x = -(y * z);