in the language reference some instructions have the following note :
´nuw and nsw stand for “No Unsigned Wrap” and “No Signed Wrap”, respectively. If the nuw and/or nsw keywords are present, the result value of the add is a poison value if unsigned and/or signed overflow, respectively, occurs.´
I understand how integer overflow works generally but i am not sure whats the difference between Unsigned and Signed Wrap. Could someone explain this ?
in the language reference some instructions have the following note :
´nuw and nsw stand for “No Unsigned Wrap” and “No Signed Wrap”,
respectively. If the nuw and/or nsw keywords are present, the result
value of the add is a poison value if unsigned and/or signed overflow,
respectively, occurs.´
I understand how integer overflow works generally but i am not sure
whats the difference between Unsigned and Signed Wrap. Could someone
explain this ?
Unsigned integer overflow occurs when the result of the operation,
interpreted over the integers, would fall outside the representable
range of the type when it represents an unsigned integer (e.g., [0,
UINT_MAX]).
Signed integer overflow occurs when the result of the operation,
interpreted over the integers, would fall outside the representable
range of the type when it represents an signed integer (e.g., [INT_MIN,
INT_MAX]).