From: Ahmed Samy Date: Wed, 13 Nov 2013 13:09:13 +0000 (+0200) Subject: cpuid: remove un-needed bit shifting X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=5d628b63760d38f7d5094141d019f4ab83546690 cpuid: remove un-needed bit shifting eax/ebx/ecx/edx are 32-bit registers, and we need 8 bits from most significand bits so there is no need to mask out 0xFF. Signed-off-by: Ahmed Samy --- diff --git a/ccan/cpuid/cpuid.c b/ccan/cpuid/cpuid.c index a64b1575..ad134b56 100644 --- a/ccan/cpuid/cpuid.c +++ b/ccan/cpuid/cpuid.c @@ -314,7 +314,7 @@ void cpuid(cpuid_t info, uint32_t *buf) buf[5] = ebx & 0xFF; buf[6] = (ebx >> 8) & 0xFF; buf[7] = (ebx >> 16) & 0xFF; - buf[8] = (ebx >> 24) & 0xFF; + buf[8] = ebx >> 24; break; case CPUID_CACHE_AND_TLBD_INFO: buf[0] = eax; @@ -330,22 +330,22 @@ void cpuid(cpuid_t info, uint32_t *buf) buf[0] = eax & 0xFF; buf[1] = (eax >> 8) & 0xFF; buf[2] = (eax >> 16) & 0xFF; - buf[3] = (eax >> 24) & 0xFF; + buf[3] = eax >> 24; buf[4] = ebx & 0xFF; buf[5] = (ebx >> 8) & 0xFF; buf[6] = (ebx >> 16) & 0xFF; - buf[7] = (ebx >> 24) & 0xFF; + buf[7] = ebx >> 24; buf[8] = ecx & 0xFF; buf[9] = (ecx >> 8) & 0xFF; buf[10] = (ecx >> 16) & 0xFF; - buf[11] = (ecx >> 24) & 0xFF; + buf[11] = ecx >> 24; buf[12] = edx & 0xFF; buf[13] = (edx >> 8) & 0xFF; buf[14] = (edx >> 16) & 0xFF; - buf[15] = (edx >> 24) & 0xFF; + buf[15] = edx >> 24; break; case CPUID_EXTENDED_L2_CACHE_FEATURES: buf[0] = ecx & 0xFF; /* Line size. */