On 1/19/19 8:40 AM, Aaron Lindsay wrote: > In practice, I think only the 32nd bit would ever need to be cleared, > but I agree it is more correct to clear them all. > >> Given that it is architecturally defined to 32-bits, I think you could really >> just drop the define and use >> >> uint32_t new_pmevcntr = ...; >> if (env->cp15.c14_pmevcntr[counter] & ~new_pmevcntr & INT32_MIN) >> >> with equal clarity. > > I don't know whether it is important for the resolution of this patch, > but what did you mean by the following?: > >> The type of new_pmevcntr means you don't have to clear any >> high bits either.
If you use uint32_t, then no *explicit* clearing of the high bits is necessary, and is implied by the assignment back to env->cp15.c14_pmevcntr[counter]. r~