@@ -97,7 +97,7 @@ std::unique_ptr <InstructionSet::InstructionSet_Internal> InstructionSet::CPU_Re
9797extern " C"
9898uint32_t
9999__cdecl
100- crc32 (uint32_t crc, _Notnull_ const void *buf, size_t size)
100+ crc32 (uint32_t crc, _Notnull_ const void *buf, size_t size) noexcept
101101{
102102 const auto *p =
103103 static_cast <const uint8_t *> (buf);
@@ -155,15 +155,15 @@ static uint32_t short_shifts [ 4][256];
155155
156156static bool _tableInitialized = false ;
157157
158- extern " C" void __cdecl calculate_table (void ) ;
158+ extern " C" void __cdecl calculate_table (void ) noexcept ;
159159
160160/* Table-driven software version as a fall-back. This is about 15 times slower
161161 than using the hardware instructions. This assumes little-endian integers,
162162 as is the case on Intel processors that the assembler code here is for. */
163163extern " C"
164164uint32_t
165165__cdecl
166- crc32c_append_sw (uint32_t crci, const void *input, size_t length)
166+ crc32c_append_sw (uint32_t crci, const void *input, size_t length) noexcept
167167{
168168 auto next =
169169 static_cast <buffer> (input);
@@ -247,7 +247,7 @@ crc32c_append_sw (uint32_t crci, const void *input, size_t length)
247247static
248248inline
249249uint32_t
250- shift_crc ( const uint32_t shift_table[][256 ], uint32_t crc )
250+ shift_crc ( const uint32_t shift_table[][256 ], uint32_t crc ) noexcept
251251{
252252 return shift_table [0 ][ crc & 0xff ]
253253 ^ shift_table [1 ][(crc >> 8 ) & 0xff ]
@@ -259,7 +259,7 @@ shift_crc ( const uint32_t shift_table[][256], uint32_t crc )
259259extern " C"
260260uint32_t
261261__cdecl
262- crc32c_append_hw (uint32_t crc, const void *buf, size_t len)
262+ crc32c_append_hw (uint32_t crc, const void *buf, size_t len) noexcept
263263{
264264 if (buf == nullptr || len < 1 )
265265 return crc;
@@ -432,7 +432,7 @@ crc32c_append_hw (uint32_t crc, const void *buf, size_t len)
432432extern " C"
433433int
434434__cdecl
435- crc32c_hw_available (void )
435+ crc32c_hw_available (void ) noexcept
436436{
437437 int info [4 ] = { 0 };
438438#ifndef SK_BUILT_BY_CLANG
@@ -447,7 +447,7 @@ crc32c_hw_available (void)
447447extern " C"
448448void
449449__cdecl
450- calculate_table (void )
450+ calculate_table (void ) noexcept
451451{
452452 for (int i = 0 ; i < 256 ; i++)
453453 {
@@ -469,7 +469,7 @@ calculate_table (void)
469469extern " C"
470470void
471471__cdecl
472- calculate_table_hw (void )
472+ calculate_table_hw (void ) noexcept
473473{
474474 for (unsigned int i = 0 ; i < 256UL ; i++)
475475 {
@@ -520,7 +520,7 @@ volatile LONG
520520
521521extern " C"
522522void __cdecl
523- __crc32_init (void )
523+ __crc32_init (void ) noexcept
524524{
525525 typedef
526526 uint32_t (__cdecl *appendfunc_pfn)( uint32_t ,
@@ -565,25 +565,8 @@ extern "C"
565565uint32_t __cdecl
566566crc32c ( uint32_t crc,
567567_Notnull_ const void *input,
568- size_t length )
568+ size_t length ) noexcept
569569{
570- if (append_func == nullptr )
571- {
572- static volatile LONG __init = 0 ;
573-
574- if (InterlockedCompareExchange (&__init, 1 , 0 ) == 0 )
575- {
576- __crc32_init ();
577-
578- InterlockedIncrement (&__init);
579- }
580-
581- else
582- {
583- SK_Thread_SpinUntilAtomicMin (&__init, 2 );
584- }
585- }
586-
587570 if ( input != nullptr &&
588571 length > 0 &&
589572 append_func != nullptr )
0 commit comments