@@ -116,18 +116,24 @@ extern void openblas_warning(int verbose, const char * msg);
116
116
117
117
static int get_vendor (void ){
118
118
int eax , ebx , ecx , edx ;
119
- char vendor [13 ];
119
+
120
+ union
121
+ {
122
+ char vchar [16 ];
123
+ int vint [4 ];
124
+ } vendor ;
120
125
121
126
cpuid (0 , & eax , & ebx , & ecx , & edx );
122
-
123
- * (int * )(& vendor [0 ]) = ebx ;
124
- * (int * )(& vendor [4 ]) = edx ;
125
- * (int * )(& vendor [8 ]) = ecx ;
126
- vendor [12 ] = (char )0 ;
127
127
128
- if (!strcmp (vendor , "GenuineIntel" )) return VENDOR_INTEL ;
129
- if (!strcmp (vendor , "AuthenticAMD" )) return VENDOR_AMD ;
130
- if (!strcmp (vendor , "CentaurHauls" )) return VENDOR_CENTAUR ;
128
+ * (& vendor .vint [0 ]) = ebx ;
129
+ * (& vendor .vint [1 ]) = edx ;
130
+ * (& vendor .vint [2 ]) = ecx ;
131
+
132
+ vendor .vchar [12 ] = '\0' ;
133
+
134
+ if (!strcmp (vendor .vchar , "GenuineIntel" )) return VENDOR_INTEL ;
135
+ if (!strcmp (vendor .vchar , "AuthenticAMD" )) return VENDOR_AMD ;
136
+ if (!strcmp (vendor .vchar , "CentaurHauls" )) return VENDOR_CENTAUR ;
131
137
132
138
if ((eax == 0 ) || ((eax & 0x500 ) != 0 )) return VENDOR_INTEL ;
133
139
@@ -232,7 +238,7 @@ static gotoblas_t *get_coretype(void){
232
238
if (family <= 0xe ) {
233
239
// Verify that CPU has 3dnow and 3dnowext before claiming it is Athlon
234
240
cpuid (0x80000000 , & eax , & ebx , & ecx , & edx );
235
- if (eax & 0xffff >= 0x01 ) {
241
+ if ( ( eax & 0xffff ) >= 0x01 ) {
236
242
cpuid (0x80000001 , & eax , & ebx , & ecx , & edx );
237
243
if ((edx & (1 << 30 )) == 0 || (edx & (1 << 31 )) == 0 )
238
244
return NULL ;
0 commit comments