FreeBSD/sys/contrib/x86emu/x86emu.c
/*
 * REMARKS:
 * Implements the ROR instruction and side effects.
 */
Implements the ROR instruction and side effects.
Implements the ROR instruction and side effects .
static uint16_t 
ror_word(struct x86emu *emu, uint16_t d, uint8_t s)
{
	unsigned int res, cnt, mask;
	res = d;
	if ((cnt = s % 16) != 0) {
		res = (d << (16 - cnt));
		mask = (1 << (16 - cnt)) - 1;
		res |= (d >> (cnt)) & mask;
		CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF);
	}
	if (s != 0) {
		CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
	}
	return (uint16_t) res;
}
static uint16_t ror_word ( struct x86emu * emu , uint16_t d , uint8_t s ) { unsigned int res , cnt , mask ; res = d ; if ( ( cnt = s % 16 ) != 0 ) { res = ( d << ( 16 - cnt ) ) ; mask = ( 1 << ( 16 - cnt ) ) - 1 ; res |= ( d >> ( cnt ) ) & mask ; CONDITIONAL_SET_FLAG ( s == 1 && XOR2 ( res >> 14 ) , F_OF ) ; } if ( s != 0 ) { CONDITIONAL_SET_FLAG ( res & 0x8000 , F_CF ) ; } return ( uint16_t ) res ; }
REMARKS:
 Implements the ROR instruction and side effects.
REMARKS : Implements the ROR instruction and side effects .
/* set the new carry flag, Note that it is the high order bit
		 * of the result!!!                               */