From: Dennis S. <sy...@yo...> - 2004-11-10 10:10:51
|
On Tue, 2004-11-09 at 23:25 -0300, Duilio Javier Protti wrote: > Reading file lv_cpuid.c I see: > > enum { > CPU_FLAGS_TSC = 1 << 4, > CPU_FLAGS_MMX = 1 << 23, > CPU_FLAGS_SSE = 1 << 25, > CPU_FLAGS_SSE2 = 1 << 26, > CPU_FLAGS_HT = 1 << 28, > }; > > enum { > CPU_FLAGS_EXT_3DNOWEXT = 1 << 30, > CPU_FLAGS_EXT_3DNOW = 1 << 31 > }; > > The problem with this code is that things like 3DNOW extension are > vendor specific, i.e. on Intel machines bit 30 says if current machine > is an IA64 or not. Ai never knew... > One way to work around this would be to give the second enum a name, say > VisAMDFlagsExtended or something, and do that for every specific vendor > supported. The problem with this is that the user of the library must be > very carefull about seeing the flags accordingly with the current > machine. > > A better approach would be to not expose the flags directly as returned > by the cpuid instruction, but instead make our own flags structure, > where the user can test against it with macros in a safe way. We don't, we have the VISUAL_CPU macros containing the final result in simply TRUE/FALSE. |