Can _mm_crc32_u64() return a value that is bigger than MAX_UINT32?

Alex Lyakas alex@zadarastorage.com
Mon Feb 12 16:19:00 GMT 2018


Hi Segher,

Thanks for your response.

Can you confirm then, that despite returning a 64-bit value, the result will 
never actually cross the maximal 32-bit value? Can you perhaps point us at 
gcc code, so that we can try to ensure that?

Thanks,
Alex.


-----Original Message----- 
From: Segher Boessenkool
Sent: Monday, February 12, 2018 5:01 PM
To: Eitan Azriel
Cc: gcc-help@gcc.gnu.org ; Alex Lyakas ; hjl.tools@gmail.com
Subject: Re: Can _mm_crc32_u64() return a value that is bigger than 
MAX_UINT32?

Hello,

On Mon, Feb 12, 2018 at 03:24:14PM +0200, Eitan Azriel wrote:
> The signature of _mm_crc32_u64() is:
> unsigned int64 _mm_crc32_u64 (
>    unsigned __int64 crc,
>    unsigned __int64 v
> );
>
> Why does it return int64, and not uint32? Shouldn't it return a valid 
> CRC32
> value?

GCC uses int64 because that is what the ABI/API says it should do.

Presumably it uses int64 for output because it does use it for input
and there was the desire to use the same type everywhere.


Segher 



More information about the Gcc-help mailing list