Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: source/cpu_id.cc

Issue 2365813002: fix warning on visual C for mips cpu detect (Closed)
Patch Set: fix warning on visual C for mips cpu detect Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « libyuv_test.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 } 158 }
159 } 159 }
160 fclose(f); 160 fclose(f);
161 return 0; 161 return 0;
162 } 162 }
163 163
164 LIBYUV_API SAFEBUFFERS 164 LIBYUV_API SAFEBUFFERS
165 int MipsCpuCaps(const char* cpuinfo_name, const char ase[]) { 165 int MipsCpuCaps(const char* cpuinfo_name, const char ase[]) {
166 char cpuinfo_line[512]; 166 char cpuinfo_line[512];
167 int len = strlen(ase); 167 int len = (int)strlen(ase);
168 FILE* f = fopen(cpuinfo_name, "r"); 168 FILE* f = fopen(cpuinfo_name, "r");
169 if (!f) { 169 if (!f) {
170 // ase enabled if /proc/cpuinfo is unavailable. 170 // ase enabled if /proc/cpuinfo is unavailable.
171 if(strcmp(ase, " msa") == 0) { 171 if (strcmp(ase, " msa") == 0) {
172 return kCpuHasMSA; 172 return kCpuHasMSA;
173 } 173 }
174 if(strcmp(ase, " dspr2") == 0) { 174 if (strcmp(ase, " dspr2") == 0) {
175 return kCpuHasDSPR2; 175 return kCpuHasDSPR2;
176 } 176 }
177 } 177 }
178 while (fgets(cpuinfo_line, sizeof(cpuinfo_line) - 1, f)) { 178 while (fgets(cpuinfo_line, sizeof(cpuinfo_line) - 1, f)) {
179 if (memcmp(cpuinfo_line, "ASEs implemented", 16) == 0) { 179 if (memcmp(cpuinfo_line, "ASEs implemented", 16) == 0) {
180 char* p = strstr(cpuinfo_line, ase); 180 char* p = strstr(cpuinfo_line, ase);
181 if (p && (p[len] == ' ' || p[len] == '\n')) { 181 if (p && (p[len] == ' ' || p[len] == '\n')) {
182 fclose(f); 182 fclose(f);
183 if(strcmp(ase, " msa") == 0) { 183 if (strcmp(ase, " msa") == 0) {
184 return kCpuHasMSA; 184 return kCpuHasMSA;
185 } 185 }
186 if(strcmp(ase, " dspr2") == 0) { 186 if (strcmp(ase, " dspr2") == 0) {
187 return kCpuHasDSPR2; 187 return kCpuHasDSPR2;
188 } 188 }
189 } 189 }
190 } 190 }
191 } 191 }
192 fclose(f); 192 fclose(f);
193 return 0; 193 return 0;
194 } 194 }
195 195
196 // CPU detect function for SIMD instruction sets. 196 // CPU detect function for SIMD instruction sets.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // Note that use of this function is not thread safe. 329 // Note that use of this function is not thread safe.
330 LIBYUV_API 330 LIBYUV_API
331 void MaskCpuFlags(int enable_flags) { 331 void MaskCpuFlags(int enable_flags) {
332 cpu_info_ = InitCpuFlags() & enable_flags; 332 cpu_info_ = InitCpuFlags() & enable_flags;
333 } 333 }
334 334
335 #ifdef __cplusplus 335 #ifdef __cplusplus
336 } // extern "C" 336 } // extern "C"
337 } // namespace libyuv 337 } // namespace libyuv
338 #endif 338 #endif
OLDNEW
« no previous file with comments | « libyuv_test.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698