Mail Archives: djgpp/2003/01/21/20:31:14
Thank you.
> Joel_S wrote:
>>
>> Ok, there are some C/C++ functions for asm opcodes, like
>> << and
>>>> for shl and shr (using Intel assembly syntax instead of AT&T).
>> And I know how to translate some opcodes that don't have a C/C++
>> equivalent. But there are some things in asm that I'm wondering
>> if I could do in C or C++, like
>> ror
>> rol
>> adc
>> sbb
>> if anybody knows how to do these in C, I'd like to know. Thanks.
>
> /* untested example */
> unsigned int ror(unsigned int n)
> {
> unsigned int signbit, sign;
>
> signbit = UINT_MAX - INT_MAX; /* shaky here */
> sign = (n & 1) * signbit;
> n = (n >> 1) | sign;
> return n;
> }
--
Posted via http://web2news.com the faster web2news on the web
- Raw text -