On 04/28/2014 06:05 AM, Dmitry Poletaev wrote: > - env->cc_src = (eflags & ~(CC_C | CC_O)) | > - (lshift(src ^ t0, 11 - (DATA_BITS - 1)) & CC_O) | > + env->cc_src = (eflags & ~CC_C) | > ((src >> (DATA_BITS - count)) & CC_C); > + if (count == 1) { > + env->cc_src |= (lshift(src ^ t0, 11 - (DATA_BITS - 1)) & CC_O); > + }
This isn't what you described either, since you fail to clear the old value of the O flag before oring in the new one. You wanted if (count == 1) { env->cc_src = (env->cc_src & ~CC_O) | (lshift(src ^ t0, 11 - (DATA_BITS - 1)) & CC_O); } First off, do more testing before submitting patches. Second, you've gotten an adequate description of why we're not going to take patches to choose one particular undefined behaviour over another. r~