In a computer processor the negative flag or sign flag is a single bit in a system status (flag) register used to indicate whether the result of the last mathematical operation resulted in a value whose most significant bit was set. In a two's complement interpretation of the result, the negative flag is set if the result was negative.
For example, in an 8-bit signed number system, -37 will be represented as 1101 1011 in binary (the most significant bit is 1), while +37 will be represented as 0010 0101 (the most significant bit is 0).
The negative flag is set according to the result in the x86 series processors by the following instructions (referring to the Intel 80386 manual ):
- All arithmetic operations except multiplication and division;
- compare instructions (equivalent to subtract instructions without storing the result);
- Logical instructions - XOR, AND, OR;
- TEST instructions (equivalent to AND instructions without storing the result).
Famous quotes containing the words negative and/or flag:
“The negative always wins at last, but I like it none the better for that.”
—Mason Cooley (b. 1927)
“Columbus stood in his age as the pioneer of progress and enlightenment. The system of universal education is in our age the most prominent and salutary feature of the spirit of enlightenment, and it is peculiarly appropriate that the schools be made by the people the center of the days demonstration. Let the national flag float over every schoolhouse in the country and the exercises be such as shall impress upon our youth the patriotic duties of American citizenship.”
—Benjamin Harrison (18331901)