00001 #include "mpeg3private.h"
00002 #include "mpeg3protos.h"
00003
00004 #include <stdio.h>
00005 #include <string.h>
00006
00007 int mpeg3_mmx_test()
00008 {
00009 int result = 0;
00010 FILE *proc;
00011 char string[MPEG3_STRLEN];
00012
00013
00014 #ifdef HAVE_MMX
00015 if(!(proc = fopen(MPEG3_PROC_CPUINFO, "r")))
00016 {
00017 fprintf(stderr, "mpeg3_mmx_test: failed to open /proc/cpuinfo\n");
00018 return 0;
00019 }
00020
00021 while(!feof(proc))
00022 {
00023 fgets(string, MPEG3_STRLEN, proc);
00024
00025 if(!strncasecmp(string, "flags", 5))
00026 {
00027 char *needle;
00028 needle = strstr(string, "mmx");
00029 if(!needle)
00030 {
00031 fclose(proc);
00032 return 0;
00033 }
00034 if(!strncasecmp(needle, "mmx", 3))
00035 {
00036 fclose(proc);
00037 return 1;
00038 }
00039 }
00040 }
00041 fclose(proc);
00042 #endif
00043
00044 return 0;
00045 }