Revision 6191b059 target-i386/helper.c
b/target-i386/helper.c | ||
---|---|---|
5240 | 5240 |
|
5241 | 5241 |
#endif |
5242 | 5242 |
|
5243 |
/* bit operations */ |
|
5244 |
target_ulong helper_bsf(target_ulong t0) |
|
5245 |
{ |
|
5246 |
int count; |
|
5247 |
target_ulong res; |
|
5248 |
|
|
5249 |
res = t0; |
|
5250 |
count = 0; |
|
5251 |
while ((res & 1) == 0) { |
|
5252 |
count++; |
|
5253 |
res >>= 1; |
|
5254 |
} |
|
5255 |
return count; |
|
5256 |
} |
|
5257 |
|
|
5258 |
target_ulong helper_bsr(target_ulong t0) |
|
5259 |
{ |
|
5260 |
int count; |
|
5261 |
target_ulong res, mask; |
|
5262 |
|
|
5263 |
res = t0; |
|
5264 |
count = TARGET_LONG_BITS - 1; |
|
5265 |
mask = (target_ulong)1 << (TARGET_LONG_BITS - 1); |
|
5266 |
while ((res & mask) == 0) { |
|
5267 |
count--; |
|
5268 |
res <<= 1; |
|
5269 |
} |
|
5270 |
return count; |
|
5271 |
} |
|
5272 |
|
|
5273 |
|
|
5243 | 5274 |
static int compute_all_eflags(void) |
5244 | 5275 |
{ |
5245 | 5276 |
return CC_SRC; |
Also available in: Unified diff