@@ -39,56 +39,6 @@ static unsigned long getauxval(unsigned long key) {
39
39
return 0 ;
40
40
return ret ;
41
41
}
42
- # elif defined(PHP_WIN32 )
43
- /*
44
- get crc32 support info
45
- this is undocumented, to be confirmed
46
- read id_aa64isar0_el1 from registry HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\x\CP 4030
47
- */
48
- int winaa64_support_crc32c () {
49
- const WCHAR cpus_key [] = L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\" ;
50
- HKEY cpus_handle ;
51
- if (ERROR_SUCCESS != RegOpenKeyExW (HKEY_LOCAL_MACHINE , cpus_key , 0 , KEY_ENUMERATE_SUB_KEYS , & cpus_handle )) {
52
- return 0 ;
53
- }
54
- DWORD cpu_index = 0 ;
55
- WCHAR cpu_num [256 ] = { 0 };
56
- uint64_t CP4030 = 0 ;
57
- WCHAR cpu_key [(sizeof (cpus_key ) / sizeof (* cpus_key )) + 256 ] = L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\" ;
58
- while (ERROR_SUCCESS == RegEnumKeyW (cpus_handle , cpu_index ++ , cpu_num , 255 )) {
59
- if (0 != wcscpy_s (& cpu_key [sizeof (cpus_key ) / sizeof (* cpus_key ) - 1 ], 256 , cpu_num )) {
60
- break ;
61
- }
62
- HKEY cpu_handle ;
63
- if (ERROR_SUCCESS != RegOpenKeyExW (HKEY_LOCAL_MACHINE , cpu_key , 0 , KEY_READ , & cpu_handle )) {
64
- break ;
65
- }
66
- DWORD value_type ;
67
- uint64_t value ;
68
- DWORD value_size = sizeof (value );
69
- if (ERROR_SUCCESS != RegQueryValueExW (cpu_handle , L"CP 4030" , NULL , & value_type , (LPBYTE )& value , & value_size )) {
70
- RegCloseKey (cpu_handle );
71
- break ;
72
- }
73
-
74
- if (REG_QWORD != value_type ) {
75
- RegCloseKey (cpu_handle );
76
- break ;
77
- }
78
- //wprintf(L"cp4030 for cpu[%d] \"%s\" is %016zx\n", cpu_index-1, cpu_num, value);
79
- // save any bits not set
80
- CP4030 |= ~value ;
81
-
82
- RegCloseKey (cpu_handle );
83
- }
84
- //printf("rev CP4030 is %016zx\n", CP4030);
85
- RegCloseKey (cpus_handle );
86
- if (CP4030 & 0x10000 /* crc32: bit 16-19 (only bit 16 used) */ ) {
87
- //printf("not supported by at least one cpu\n");
88
- return 0 ;
89
- }
90
- return 1 ;
91
- }
92
42
# endif
93
43
94
44
static inline int has_crc32_insn () {
@@ -108,7 +58,7 @@ static inline int has_crc32_insn() {
108
58
res = 0 ;
109
59
return res ;
110
60
# elif defined(WIN32 )
111
- res = winaa64_support_crc32c ( );
61
+ res = ( int ) IsProcessorFeaturePresent ( PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE );
112
62
return res ;
113
63
# else
114
64
res = 0 ;
0 commit comments