This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Hi,
I'm adding to 32-Bit values (c-code) and want to evaluate the carry bit (TM4C129, launchpad). I think this bit is in Register APSR, but I have no idea howto access to the core registers in c. Is there any simple way?
Thanks for any help
Regards
Micky
Michael Schuster said:I'm adding to 32-Bit values (c-code) and want to evaluate the carry bit
Why? I'm trying to think of cases where it would be a) useful and b) well defined. I can't come up with any (especially b).
Robert
As so often noted - posters NEVER/EVER justify their (bit strange) requests...
As the initial answering post stated - poster (claimed) to be using "C" (negating such a need) - this (use of C) may prove NOT the (real) case!
Hi Robert,
did you see the link above (bisqwit.iki.fi/.../ and "Addition of larger integers than native register size").
I want to add large ints and thought it might be easier to get the carry directly than with a comparison as with the pseudo code :
uint_type a = original_1;
uint_type b = original_2;
uint_type result = a + b;
bool carry = result < a;
Michael Schuster said:did you see the link above (bisqwit.iki.fi/.../ and "Addition of larger integers than native register size").
I don't follow links w/o at least some explanation of what hey are and I'm cautious even then.
Michael Schuster said:I want to add large ints and thought it might be easier to get the carry directly than with a comparison as with the pseudo code :
You do realize that there is native support for this, far more efficient than anything you could write. At least up to 64bits. Beyond that there are available libraries.
Robert
Michael Schuster said:I need 256 Bit. Well I can use the pseudo code, but I just was wondering howto have access to the carry bit.
There are readily available libraries that will do that for you .
I don't think there is, on any processor, a sure way of accessing the carry bit after an addition. At the very least you'd need to play games with volatile. By the time you were done you'd likely be as far or further ahead to use assembly.
Robert