FreeBSD/sys/contrib/x86emu/x86emu.c
/*
 * REMARKS:
 * Implements the ROL instruction and side effects.
 */
Implements the ROL instruction and side effects.
Implements the ROL instruction and side effects .
static uint32_t 
rol_long(struct x86emu *emu, uint32_t d, uint8_t s)
{
	uint32_t res, cnt, mask;
	res = d;
	if ((cnt = s % 32) != 0) {
		res = (d << cnt);
		mask = (1 << cnt) - 1;
		res |= (d >> (32 - cnt)) & mask;
		CONDITIONAL_SET_FLAG(s == 1 &&
		    XOR2((res & 0x1) + ((res >> 30) & 0x2)),
		    F_OF);
	}
	if (s != 0) {
		CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
	}
	return res;
}
static uint32_t rol_long ( struct x86emu * emu , uint32_t d , uint8_t s ) { uint32_t res , cnt , mask ; res = d ; if ( ( cnt = s % 32 ) != 0 ) { res = ( d << cnt ) ; mask = ( 1 << cnt ) - 1 ; res |= ( d >> ( 32 - cnt ) ) & mask ; CONDITIONAL_SET_FLAG ( s == 1 && XOR2 ( ( res & 0x1 ) + ( ( res >> 30 ) & 0x2 ) ) , F_OF ) ; } if ( s != 0 ) { CONDITIONAL_SET_FLAG ( res & 0x1 , F_CF ) ; } return res ; }
REMARKS:
 Implements the ROL instruction and side effects.
REMARKS : Implements the ROL instruction and side effects .
/* set the new carry flag, Note that it is the low order bit
		 * of the result!!!                               */