I guess it all depends on what you want to do...
The BIC operation has no real concept of a signed or unsigned int.. it
only views the variable as a bit field.
Having the cast there obviously makes it invalid, as you can't assign
back through a cast. So the cast has to go.
The variable will also be treated entirely as a bit field, which seems
to be what you'd like.
I would think the warning is somewhat incorrect, as it should really be
an error I imagine.
Does the code execute as intended? I would think it would do
essentially nothing...
A temporary register would likely be created for the rval ((unsigned
int)x), which would then have the
bic operation executed on it. However after that instruction the rval
can essentially be destroyed (its scope only has to be the operation
it's used in).
This would leave the original variable x unchanged.
If this is actually to change the status register, there's already
functions provided to do this, it's all in the FAQ.
If it's just for efficient bit setting on a variable, then I'm quite
sure x &= ~bitmask; reduces down to the bic instruction..
Haven't checked on this though..
Bevan
Hi,
I am at the moment having a problem with the following inline
assembler expression:
#define SR_BIC(x) __asm__ __volatile__("bic %0, r2"::"m" ((unsigned
int)x))
msp430-gcc 3.3.6 claims "warning: use of memory input without lvalue
in asm operand 0 is deprecated"
Is it safe to remove the unsigned int here or another way to deal with
this warning?
Thanks in advance
Juergen
------------------------------------------------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
------------------------------------------------------------------------
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users