home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kcpuinfo.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  2.6 KB  |  71 lines

  1. /*
  2.  * This file is part of the KDE libraries
  3.  * Copyright (C) 2003 Fredrik H÷glund <fredrik@kde.org>
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * 1. Redistributions of source code must retain the above copyright
  10.  *    notice, this list of conditions and the following disclaimer.
  11.  * 2. Redistributions in binary form must reproduce the above copyright
  12.  *    notice, this list of conditions and the following disclaimer in the
  13.  *    documentation and/or other materials provided with the distribution.
  14.  *
  15.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  17.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  18.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  21.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  22.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25.  */
  26.  
  27. #ifndef __KCPUINFO_H
  28. #define __KCPUINFO_H
  29.  
  30. #include <kdelibs_export.h>
  31.  
  32. /**
  33.  * This class provides a means for applications to obtain information at
  34.  * runtime about processor support for certain architecture extensions,
  35.  * such as MMX, SSE, 3DNow and AltiVec.
  36.  *
  37.  * @since 3.2
  38.  */
  39. class KDEFX_EXPORT KCPUInfo
  40. {
  41.     public:
  42.        /**
  43.          * This enum contains the list of architecture extensions you
  44.          * can query.
  45.          */
  46.         enum Extensions {
  47.             IntelMMX        = 1 << 0,  //!< Intel's MMX instructions.
  48.             IntelSSE        = 1 << 1,  //!< Intel's SSE instructions.
  49.             IntelSSE2       = 1 << 2,  //!< Intel's SSE2 instructions.
  50.             AMD3DNOW        = 1 << 3,  //!< AMD 3DNOW instructions
  51.             AltiVec         = 1 << 4   //!< Motorola AltiVec instructions
  52.         };
  53.  
  54.         /**
  55.          * Returns true if the processor supports @p extension,
  56.          * and false otherwise.
  57.          *
  58.          * @param   extension the feature to query.
  59.          * @return  If true, the processor supports @p extension.
  60.          * @see     Extensions
  61.          */
  62.         static bool haveExtension( unsigned int extension )
  63.         { return (s_features & extension) != 0; }
  64.  
  65.     private:
  66.         static unsigned int s_features;
  67. };
  68.  
  69. #endif
  70.  
  71.