12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- static int
- png_have_msa(png_structp png_ptr)
- {
- FILE *f = fopen("/proc/cpuinfo", "rb");
- char *string = "msa";
- char word[10];
- if (f != NULL)
- {
- while(!feof(f))
- {
- int ch = fgetc(f);
- static int i = 0;
- while(!(ch <= 32))
- {
- word[i++] = ch;
- ch = fgetc(f);
- }
- int val = strcmp(string, word);
- if (val == 0)
- return 1;
- i = 0;
- memset(word, 0, 10);
- }
- fclose(f);
- }
- #ifdef PNG_WARNINGS_SUPPORTED
- else
- png_warning(png_ptr, "/proc/cpuinfo open failed");
- #endif
- return 0;
- }
|