I
Immortal Nephi
I do math calculation. I decide to limit the integer to 8 bits. If
it exceeds 0xFF, then Carry flag should be set. C++ Compiler does not
have the feature. I believe that it can be done to use if keyword.
For example
unsigned char Low_Byte = 0xFF;
unsigned char High_Byte = 0x20;
unsigned char Carry = 0x00;
Low_Byte++;
// Use IF to detect Carry
// How?
if (Carry ??? Low_Byte)
{
High_Byte++;
}
Please do not tell me to use short or long instead of char like this
below.
unsigned short Low_Byte = 0xFF;
unsigned short High_Byte = 0x20;
unsigned short Carry = 0;
Low_Byte++;
Carry = Low_Byte >> 8;
Low_Byte &= 0xFF;
High_Byte += Carry;
Thanks...
it exceeds 0xFF, then Carry flag should be set. C++ Compiler does not
have the feature. I believe that it can be done to use if keyword.
For example
unsigned char Low_Byte = 0xFF;
unsigned char High_Byte = 0x20;
unsigned char Carry = 0x00;
Low_Byte++;
// Use IF to detect Carry
// How?
if (Carry ??? Low_Byte)
{
High_Byte++;
}
Please do not tell me to use short or long instead of char like this
below.
unsigned short Low_Byte = 0xFF;
unsigned short High_Byte = 0x20;
unsigned short Carry = 0;
Low_Byte++;
Carry = Low_Byte >> 8;
Low_Byte &= 0xFF;
High_Byte += Carry;
Thanks...