_ZN4Ogre9ExceptionD2Ev:
  136|    492|        ~Exception() throw() {}

_ZN4Ogre10FactoryObjINS_7ArchiveEED2Ev:
   47|    246|        virtual ~FactoryObj() {}
_ZN4Ogre10FactoryObjINS_7ArchiveEE15destroyInstanceEPS1_:
   65|    246|        virtual void destroyInstance(T* ptr) { delete ptr; }

_ZN4Ogre13OptimisedUtilC2Ev:
   64|      2|        OptimisedUtil(void) {}

_ZN4Ogre16StreamSerialiser5ChunkC2Ev:
  105|    238|            Chunk() : id(0), version(1), length(0), offset(0) {}
_ZN4Ogre16StreamSerialiser4readIjEEvPT_m:
  301|    629|        {
  302|    629|            readData(pT, sizeof(T), count);
  303|    629|        }
_ZN4Ogre16StreamSerialiser4readItEEvPT_m:
  301|    238|        {
  302|    238|            readData(pT, sizeof(T), count);
  303|    238|        }
_ZN4Ogre16StreamSerialiser4readIcEEvPT_m:
  301|     84|        {
  302|     84|            readData(pT, sizeof(T), count);
  303|     84|        }

_ZN4Ogre20FileStreamDataStreamC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEPNS1_14basic_ifstreamIcS4_EEmb:
  493|    246|        : DataStream(name), mInStream(s), mFStreamRO(s), mFStream(0), mFreeOnClose(freeOnClose)
  494|    246|    {
  495|       |        // Size is passed in
  496|    246|        mSize = inSize;
  497|    246|        determineAccess();
  498|    246|    }
_ZN4Ogre20FileStreamDataStream15determineAccessEv:
  535|    246|    {
  536|    246|        mAccess = 0;
  537|    246|        if (mInStream)
  ------------------
  |  Branch (537:13): [True: 246, False: 0]
  ------------------
  538|    246|            mAccess |= READ;
  539|    246|        if (mFStream)
  ------------------
  |  Branch (539:13): [True: 0, False: 246]
  ------------------
  540|      0|            mAccess |= WRITE;
  541|    246|    }
_ZN4Ogre20FileStreamDataStreamD2Ev:
  544|    246|    {
  545|    246|        close();
  546|    246|    }
_ZN4Ogre20FileStreamDataStream4readEPvm:
  549|  1.15k|    {
  550|  1.15k|        mInStream->read(static_cast<char*>(buf), static_cast<std::streamsize>(count));
  551|  1.15k|        return (size_t)mInStream->gcount();
  552|  1.15k|    }
_ZN4Ogre20FileStreamDataStream4skipEl:
  633|    246|    {
  634|       |#if defined(STLPORT)
  635|       |        // Workaround for STLport issues: After reached eof of file stream,
  636|       |        // it's seems the stream was putted in intermediate state, and will be
  637|       |        // fail if try to repositioning relative to current position.
  638|       |        // Note: tellg() fail in this case too.
  639|       |        if (mInStream->eof())
  640|       |        {
  641|       |            mInStream->clear();
  642|       |            // Use seek relative to either begin or end to bring the stream
  643|       |            // back to normal state.
  644|       |            mInStream->seekg(0, std::ios::end);
  645|       |        }
  646|       |#endif      
  647|    246|        mInStream->clear(); //Clear fail status in case eof was set
  648|    246|        mInStream->seekg(static_cast<std::ifstream::pos_type>(count), std::ios::cur);
  649|    246|    }
_ZN4Ogre20FileStreamDataStream4seekEm:
  652|     34|    {
  653|     34|        mInStream->clear(); //Clear fail status in case eof was set
  654|     34|        mInStream->seekg(static_cast<std::streamoff>(pos), std::ios::beg);
  655|     34|    }
_ZNK4Ogre20FileStreamDataStream4tellEv:
  658|    322|    {
  659|    322|        mInStream->clear(); //Clear fail status in case eof was set
  660|    322|        return (size_t)mInStream->tellg();
  661|    322|    }
_ZNK4Ogre20FileStreamDataStream3eofEv:
  664|    951|    {
  665|    951|        return mInStream->eof();
  666|    951|    }
_ZN4Ogre20FileStreamDataStream5closeEv:
  669|    246|    {
  670|    246|        mAccess = 0;
  671|    246|        if (mInStream)
  ------------------
  |  Branch (671:13): [True: 246, False: 0]
  ------------------
  672|    246|        {
  673|       |            // Unfortunately, there is no file-specific shared class hierarchy between fstream and ifstream (!!)
  674|    246|            if (mFStreamRO)
  ------------------
  |  Branch (674:17): [True: 246, False: 0]
  ------------------
  675|    246|                mFStreamRO->close();
  676|    246|            if (mFStream)
  ------------------
  |  Branch (676:17): [True: 0, False: 246]
  ------------------
  677|      0|            {
  678|      0|                mFStream->flush();
  679|      0|                mFStream->close();
  680|      0|            }
  681|       |
  682|    246|            if (mFreeOnClose)
  ------------------
  |  Branch (682:17): [True: 246, False: 0]
  ------------------
  683|    246|            {
  684|       |                // delete the stream too
  685|    246|                OGRE_DELETE_T(mFStreamRO, basic_ifstream, MEMCATEGORY_GENERAL);
  686|    246|                OGRE_DELETE_T(mFStream, basic_fstream, MEMCATEGORY_GENERAL);
  687|    246|            }
  688|       |
  689|    246|            mInStream = 0;
  690|    246|            mFStreamRO = 0; 
  691|    246|            mFStream = 0; 
  692|    246|        }
  693|    246|    }

_ZN4Ogre9ExceptionC2EiRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_PKcSB_l:
   43|    246|        line( lin ),
   44|    246|        typeName(typ),
   45|    246|        description( desc ),
   46|    246|        source( src ),
   47|    246|        file( fil )
   48|    246|    {
   49|    246|        StringStream ss;
   50|       |
   51|    246|        ss << typeName << ": "
   52|    246|           << description
   53|    246|           << " in " << source;
   54|       |
   55|    246|        if( line > 0 )
  ------------------
  |  Branch (55:13): [True: 246, False: 0]
  ------------------
   56|    246|        {
   57|    246|            ss << " at " << file << " (line " << line << ")";
   58|    246|        }
   59|       |
   60|    246|        fullDesc = ss.str();
   61|    246|    }
_ZN4Ogre9ExceptionC2ERKS0_:
   64|    246|        : line( rhs.line ), 
   65|    246|        typeName( rhs.typeName ), 
   66|    246|        description( rhs.description ), 
   67|    246|        source( rhs.source ), 
   68|    246|        file( rhs.file )
   69|    246|    {
   70|    246|    }

_ZN4Ogre15_openFileStreamERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEjS8_:
  345|    246|    {
  346|       |        // Use filesystem to determine size 
  347|       |        // (quicker than streaming to the end and back)
  348|       |#ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE
  349|       |		struct _stat64i32 tagStat;
  350|       |		int ret = _wstat(to_wpath(full_path).c_str(), &tagStat);
  351|       |#else
  352|    246|        struct stat tagStat;
  353|    246|        int ret = stat(full_path.c_str(), &tagStat);
  354|    246|#endif
  355|    246|        size_t st_size = ret == 0 ? tagStat.st_size : 0;
  ------------------
  |  Branch (355:26): [True: 246, False: 0]
  ------------------
  356|       |
  357|    246|        std::istream* baseStream = 0;
  358|    246|        std::ifstream* roStream = 0;
  359|    246|        std::fstream* rwStream = 0;
  360|       |
  361|    246|        if (mode & std::ios::out)
  ------------------
  |  Branch (361:13): [True: 0, False: 246]
  ------------------
  362|      0|        {
  363|      0|            rwStream = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
  364|       |#ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE
  365|       |			rwStream->open(to_wpath(full_path).c_str(), mode);
  366|       |#else
  367|      0|            rwStream->open(full_path.c_str(), mode);
  368|      0|#endif
  369|      0|            baseStream = rwStream;
  370|      0|        }
  371|    246|        else
  372|    246|        {
  373|    246|            roStream = OGRE_NEW_T(std::ifstream, MEMCATEGORY_GENERAL)();
  374|       |#ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE
  375|       |			roStream->open(to_wpath(full_path).c_str(), mode);
  376|       |#else
  377|    246|            roStream->open(full_path.c_str(), mode);
  378|    246|#endif
  379|    246|            baseStream = roStream;
  380|    246|        }
  381|       |
  382|       |
  383|       |        // Should check ensure open succeeded, in case fail for some reason.
  384|    246|        if (baseStream->fail())
  ------------------
  |  Branch (384:13): [True: 0, False: 246]
  ------------------
  385|      0|        {
  386|      0|            OGRE_DELETE_T(roStream, basic_ifstream, MEMCATEGORY_GENERAL);
  387|      0|            OGRE_DELETE_T(rwStream, basic_fstream, MEMCATEGORY_GENERAL);
  388|      0|            OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND, "Cannot open file: " + full_path);
  389|      0|        }
  390|       |
  391|       |        /// Construct return stream, tell it to delete on destroy
  392|    246|        FileStreamDataStream* stream = 0;
  393|    246|        const String& streamname = name.empty() ? full_path : name;
  ------------------
  |  Branch (393:36): [True: 0, False: 246]
  ------------------
  394|    246|        if (rwStream)
  ------------------
  |  Branch (394:13): [True: 0, False: 246]
  ------------------
  395|      0|        {
  396|       |            // use the writeable stream
  397|      0|            stream = OGRE_NEW FileStreamDataStream(streamname, rwStream, st_size);
  398|      0|        }
  399|    246|        else
  400|    246|        {
  401|    246|            OgreAssertDbg(ret == 0, "Problem getting file size");
  402|       |            // read-only stream
  403|       |            stream = OGRE_NEW FileStreamDataStream(streamname, roStream, st_size);
  404|    246|        }
  405|    246|        return DataStreamPtr(stream);
  406|    246|    }
_ZNK4Ogre24FileSystemArchiveFactory7getTypeEv:
  553|    246|    {
  554|    246|        static String name = "FileSystem";
  555|    246|        return name;
  556|    246|    }
_ZN4Ogre24FileSystemArchiveFactory14createInstanceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEb:
  559|    246|    {
  560|       |        return OGRE_NEW FileSystemArchive(name, getType(), readOnly);
  561|    246|    }
OgreFileSystem.cpp:_ZN4Ogre12_GLOBAL__N_117FileSystemArchiveC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_b:
  123|    246|        : Archive(name, archType)
  124|    246|    {
  125|       |        // Even failed attempt to write to read only location violates Apple AppStore validation process.
  126|       |        // And successful writing to some probe file does not prove that whole location with subfolders 
  127|       |        // is writable. Therefore we accept read only flag from outside and do not try to be too smart.
  128|    246|        mReadOnly = readOnly;
  129|    246|    }
OgreFileSystem.cpp:_ZN4Ogre12_GLOBAL__N_117FileSystemArchiveD2Ev:
  315|    246|    {
  316|    246|        unload();
  317|    246|    }
OgreFileSystem.cpp:_ZN4Ogre12_GLOBAL__N_117FileSystemArchive4loadEv:
  320|    246|    {
  321|       |        // nothing to do here
  322|    246|    }
OgreFileSystem.cpp:_ZN4Ogre12_GLOBAL__N_117FileSystemArchive6unloadEv:
  325|    246|    {
  326|       |        // nothing to see here, move along
  327|    246|    }
OgreFileSystem.cpp:_ZNK4Ogre12_GLOBAL__N_117FileSystemArchive4openERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
  330|    246|    {
  331|    246|        if (!readOnly && isReadOnly())
  ------------------
  |  Branch (331:13): [True: 0, False: 246]
  |  Branch (331:26): [True: 0, False: 0]
  ------------------
  332|      0|        {
  333|      0|            OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Cannot open a file in read-write mode in a read-only archive");
  334|      0|        }
  335|       |
  336|       |        // Always open in binary mode
  337|       |        // Also, always include reading
  338|    246|        std::ios::openmode mode = std::ios::in | std::ios::binary;
  339|       |
  340|    246|        if(!readOnly) mode |= std::ios::out;
  ------------------
  |  Branch (340:12): [True: 0, False: 246]
  ------------------
  341|       |
  342|    246|        return _openFileStream(concatenate_path(mName, filename), mode, filename);
  343|    246|    }
OgreFileSystem.cpp:_ZN4OgreL16concatenate_pathERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  160|    246|    {
  161|    246|        if (base.empty() || is_absolute_path(name.c_str()))
  ------------------
  |  Branch (161:13): [True: 0, False: 246]
  |  Branch (161:29): [True: 246, False: 0]
  ------------------
  162|    246|            return name;
  163|      0|        else
  164|      0|            return base + '/' + name;
  165|    246|    }
OgreFileSystem.cpp:_ZN4OgreL16is_absolute_pathEPKc:
  151|    246|    {
  152|       |#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
  153|       |        if (isalpha(uchar(path[0])) && path[1] == ':')
  154|       |            return true;
  155|       |#endif
  156|    246|        return path[0] == '/' || path[0] == '\\';
  ------------------
  |  Branch (156:16): [True: 246, False: 0]
  |  Branch (156:34): [True: 0, False: 0]
  ------------------
  157|    246|    }

_ZN4Ogre13OptimisedUtil21_detectImplementationEv:
  326|      2|    {
  327|       |        //
  328|       |        // Some speed test results (averaged number of CPU timestamp (RDTSC) per-function call):
  329|       |        //
  330|       |        //   Dagon SkeletonAnimation sample - softwareVertexSkinning:
  331|       |        //
  332|       |        //                                      Pentium 4 3.0G HT       Athlon XP 2500+     Athlon 64 X2 Dual Core 3800+
  333|       |        //
  334|       |        //      Shared Buffers, General C       763677                  462903              473038
  335|       |        //      Shared Buffers, Unrolled SSE    210030 *best*           369762              228328 *best*
  336|       |        //      Shared Buffers, General SSE     286202                  352412 *best*       302796
  337|       |        //
  338|       |        //      Separated Buffers, General C    762640                  464840              478740
  339|       |        //      Separated Buffers, Unrolled SSE 219222 *best*           287992 *best*       238770 *best*
  340|       |        //      Separated Buffers, General SSE  290129                  341614              307262
  341|       |        //
  342|       |        //      PosOnly, General C              388663                  257350              262831
  343|       |        //      PosOnly, Unrolled SSE           139814 *best*           200323 *best*       168995 *best*
  344|       |        //      PosOnly, General SSE            172693                  213704              175447
  345|       |        //
  346|       |        //   Another my own test scene - softwareVertexSkinning:
  347|       |        //
  348|       |        //                                      Pentium P4 3.0G HT      Athlon XP 2500+
  349|       |        //
  350|       |        //      Shared Buffers, General C       74527                   -
  351|       |        //      Shared Buffers, Unrolled SSE    22743 *best*            -
  352|       |        //      Shared Buffers, General SSE     28527                   -
  353|       |        //
  354|       |        //
  355|       |        // Note that speed test appears unaligned load/store instruction version
  356|       |        // loss performance 5%-10% than aligned load/store version, even if both
  357|       |        // of them access to aligned data. Thus, we should use aligned load/store
  358|       |        // as soon as possible.
  359|       |        //
  360|       |        //
  361|       |        // We are pick up the implementation based on test results above.
  362|       |        //
  363|       |#ifdef __DO_PROFILE__
  364|       |        {
  365|       |            static OptimisedUtilProfiler msOptimisedUtilProfiler;
  366|       |            return &msOptimisedUtilProfiler;
  367|       |        }
  368|       |
  369|       |#else   // !__DO_PROFILE__
  370|       |
  371|      2|#if __OGRE_HAVE_SSE
  372|      2|        if (PlatformInformation::getCpuFeatures() & PlatformInformation::CPU_FEATURE_SSE)
  ------------------
  |  Branch (372:13): [True: 2, False: 0]
  ------------------
  373|      2|        {
  374|      2|            return _getOptimisedUtilSSE();
  375|      2|        }
  376|      0|        else
  377|       |#elif __OGRE_HAVE_NEON
  378|       |        if (PlatformInformation::getCpuFeatures() & PlatformInformation::CPU_FEATURE_NEON)
  379|       |        {
  380|       |            return _getOptimisedUtilSSE();
  381|       |        }
  382|       |        else
  383|       |#endif  // __OGRE_HAVE_SSE
  384|      0|        {
  385|      0|            return _getOptimisedUtilGeneral();
  386|      0|        }
  387|       |
  388|      2|#endif  // __DO_PROFILE__
  389|      2|    }

_ZN4Ogre16OptimisedUtilSSEC2Ev:
 1040|      2|        : mPreferGeneralVersionForSharedBuffers(false)
 1041|      2|    {
 1042|       |        // For AMD Athlon XP (but not that for Althon 64), it's prefer to never use
 1043|       |        // unrolled version for shared buffers at all, I guess because that version
 1044|       |        // run out of usable CPU registers, or L1/L2 cache related problem, causing
 1045|       |        // slight performance loss than general version.
 1046|       |        //
 1047|      2|#if __OGRE_HAVE_NEON == 0
 1048|      2|        if (PlatformInformation::getCpuIdentifier().find("AuthenticAMD") != String::npos)
  ------------------
  |  Branch (1048:13): [True: 2, False: 0]
  ------------------
 1049|      2|        {
 1050|       |            // How can I check it's an Athlon XP but not Althon 64?
 1051|       |            // Ok, just test whether supports SSE2/SSE3 or not, if not,
 1052|       |            // assume general version faster than unrolled version :)
 1053|       |            //
 1054|      2|            if (!(PlatformInformation::getCpuFeatures() &
  ------------------
  |  Branch (1054:17): [True: 0, False: 2]
  ------------------
 1055|      2|                (PlatformInformation::CPU_FEATURE_SSE2 | PlatformInformation::CPU_FEATURE_SSE3)))
 1056|      0|            {
 1057|      0|                mPreferGeneralVersionForSharedBuffers = true;
 1058|      0|            }
 1059|      2|        }
 1060|      2|#endif
 1061|      2|    }
_ZN4Ogre20_getOptimisedUtilSSEEv:
 2141|      2|    {
 2142|      2|        static OptimisedUtilSSE msOptimisedUtilSSE;
 2143|       |#if defined(__OGRE_SIMD_ALIGN_STACK)
 2144|       |        static OptimisedUtilWithStackAlign msOptimisedUtilWithStackAlign(&msOptimisedUtilSSE);
 2145|       |        return &msOptimisedUtilWithStackAlign;
 2146|       |#else
 2147|      2|        return &msOptimisedUtilSSE;
 2148|      2|#endif
 2149|      2|    }

_ZN4Ogre19PlatformInformation16getCpuIdentifierEv:
  655|      2|    {
  656|      2|        static const String sIdentifier = _detectCpuIdentifier();
  657|      2|        return sIdentifier;
  658|      2|    }
_ZN4Ogre19PlatformInformation14getCpuFeaturesEv:
  661|      4|    {
  662|      4|        static const uint sFeatures = _detectCpuFeatures();
  663|      4|        return sFeatures;
  664|      4|    }
OgrePlatformInformation.cpp:_ZN4OgreL20_detectCpuIdentifierEv:
  427|      2|    {
  428|       |        // Supports CPUID instruction ?
  429|      2|        if (_isSupportCpuid())
  ------------------
  |  Branch (429:13): [True: 2, False: 0]
  ------------------
  430|      2|        {
  431|      2|            CpuidResult result;
  432|      2|            uint nExIds;
  433|      2|            char CPUString[0x20];
  434|      2|            char CPUBrandString[0x40];
  435|       |
  436|      2|            StringStream detailedIdentStr;
  437|       |
  438|       |
  439|       |            // Has standard feature ?
  440|      2|            if (_performCpuid(0, result))
  ------------------
  |  Branch (440:17): [True: 2, False: 0]
  ------------------
  441|      2|            {
  442|      2|                memset(CPUString, 0, sizeof(CPUString));
  443|      2|                memset(CPUBrandString, 0, sizeof(CPUBrandString));
  444|       |
  445|       |                //*((int*)CPUString) = result._ebx;
  446|       |                //*((int*)(CPUString+4)) = result._edx;
  447|       |                //*((int*)(CPUString+8)) = result._ecx;
  448|      2|                memcpy(CPUString, &result._ebx, sizeof(int));
  449|      2|                memcpy(CPUString+4, &result._edx, sizeof(int));
  450|      2|                memcpy(CPUString+8, &result._ecx, sizeof(int));
  451|       |
  452|      2|                detailedIdentStr << CPUString;
  453|       |
  454|       |                // Calling _performCpuid with 0x80000000 as the query argument
  455|       |                // gets the number of valid extended IDs.
  456|      2|                nExIds = _performCpuid(0x80000000, result);
  457|       |
  458|     70|                for (uint i=0x80000000; i<=nExIds; ++i)
  ------------------
  |  Branch (458:41): [True: 68, False: 2]
  ------------------
  459|     68|                {
  460|     68|                    _performCpuid(i, result);
  461|       |
  462|       |                    // Interpret CPU brand string and cache information.
  463|     68|                    if  (i == 0x80000002)
  ------------------
  |  Branch (463:26): [True: 2, False: 66]
  ------------------
  464|      2|                    {
  465|      2|                        memcpy(CPUBrandString + 0, &result._eax, sizeof(result._eax));
  466|      2|                        memcpy(CPUBrandString + 4, &result._ebx, sizeof(result._ebx));
  467|      2|                        memcpy(CPUBrandString + 8, &result._ecx, sizeof(result._ecx));
  468|      2|                        memcpy(CPUBrandString + 12, &result._edx, sizeof(result._edx));
  469|      2|                    }
  470|     66|                    else if  (i == 0x80000003)
  ------------------
  |  Branch (470:31): [True: 2, False: 64]
  ------------------
  471|      2|                    {
  472|      2|                        memcpy(CPUBrandString + 16 + 0, &result._eax, sizeof(result._eax));
  473|      2|                        memcpy(CPUBrandString + 16 + 4, &result._ebx, sizeof(result._ebx));
  474|      2|                        memcpy(CPUBrandString + 16 + 8, &result._ecx, sizeof(result._ecx));
  475|      2|                        memcpy(CPUBrandString + 16 + 12, &result._edx, sizeof(result._edx));
  476|      2|                    }
  477|     64|                    else if  (i == 0x80000004)
  ------------------
  |  Branch (477:31): [True: 2, False: 62]
  ------------------
  478|      2|                    {
  479|      2|                        memcpy(CPUBrandString + 32 + 0, &result._eax, sizeof(result._eax));
  480|      2|                        memcpy(CPUBrandString + 32 + 4, &result._ebx, sizeof(result._ebx));
  481|      2|                        memcpy(CPUBrandString + 32 + 8, &result._ecx, sizeof(result._ecx));
  482|      2|                        memcpy(CPUBrandString + 32 + 12, &result._edx, sizeof(result._edx));
  483|      2|                    }
  484|     68|                }
  485|       |
  486|      2|                String brand(CPUBrandString);
  487|      2|                StringUtil::trim(brand);
  488|      2|                if (!brand.empty())
  ------------------
  |  Branch (488:21): [True: 2, False: 0]
  ------------------
  489|      2|                    detailedIdentStr << ": " << brand;
  490|       |
  491|      2|                return detailedIdentStr.str();
  492|      2|            }
  493|      2|        }
  494|       |
  495|      0|        return "X86";
  496|      2|    }
OgrePlatformInformation.cpp:_ZN4OgreL13_performCpuidEiRNS_11CpuidResultE:
  151|     82|    {
  152|       |#if OGRE_COMPILER == OGRE_COMPILER_MSVC
  153|       |        int CPUInfo[4];
  154|       |        __cpuid(CPUInfo, query);
  155|       |        result._eax = CPUInfo[0];
  156|       |        result._ebx = CPUInfo[1];
  157|       |        result._ecx = CPUInfo[2];
  158|       |        result._edx = CPUInfo[3];
  159|       |        return result._eax;
  160|       |#elif (OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG) && OGRE_PLATFORM != OGRE_PLATFORM_EMSCRIPTEN
  161|       |        #if OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_64
  162|     82|        __asm__
  163|     82|        (
  164|     82|            "cpuid": "=a" (result._eax), "=b" (result._ebx), "=c" (result._ecx), "=d" (result._edx) : "a" (query)
  165|     82|        );
  166|       |        #else
  167|       |        __asm__
  168|       |        (
  169|       |            "pushl  %%ebx           \n\t"
  170|       |            "cpuid                  \n\t"
  171|       |            "movl   %%ebx, %%edi    \n\t"
  172|       |            "popl   %%ebx           \n\t"
  173|       |            : "=a" (result._eax), "=D" (result._ebx), "=c" (result._ecx), "=d" (result._edx)
  174|       |            : "a" (query)
  175|       |        );
  176|       |       #endif // OGRE_ARCHITECTURE_64
  177|     82|        return result._eax;
  178|       |
  179|       |#else
  180|       |        // TODO: Supports other compiler
  181|       |        return 0;
  182|       |#endif
  183|     82|    }
OgrePlatformInformation.cpp:_ZN4OgreL18_detectCpuFeaturesEv:
  408|      2|    {
  409|      2|        uint features = queryCpuFeatures();
  410|       |
  411|      2|        const uint sse_features = 0
  412|      2|            | PlatformInformation::CPU_FEATURE_SSE
  413|      2|            | PlatformInformation::CPU_FEATURE_SSE2
  414|      2|            | PlatformInformation::CPU_FEATURE_SSE3
  415|      2|            | PlatformInformation::CPU_FEATURE_SSE41
  416|      2|            | PlatformInformation::CPU_FEATURE_SSE42;
  417|       |
  418|      2|        if ((features & sse_features) && !_checkOperatingSystemSupportSSE())
  ------------------
  |  Branch (418:13): [True: 2, False: 0]
  |  Branch (418:42): [True: 0, False: 2]
  ------------------
  419|      0|        {
  420|      0|            features &= ~sse_features;
  421|      0|        }
  422|       |
  423|      2|        return features;
  424|      2|    }
OgrePlatformInformation.cpp:_ZN4OgreL16queryCpuFeaturesEv:
  266|      2|    {
  267|       |
  268|      2|#define CPUID_FUNC_VENDOR_ID                 0x0
  269|      2|#define CPUID_FUNC_STANDARD_FEATURES         0x1
  270|      2|#define CPUID_FUNC_EXTENSION_QUERY           0x80000000
  271|      2|#define CPUID_FUNC_EXTENDED_FEATURES         0x80000001
  272|      2|#define CPUID_FUNC_ADVANCED_POWER_MANAGEMENT 0x80000007
  273|       |
  274|      2|#define CPUID_STD_FPU               (1<<0)
  275|      2|#define CPUID_STD_TSC               (1<<4)
  276|      2|#define CPUID_STD_CMOV              (1<<15)
  277|      2|#define CPUID_STD_MMX               (1<<23)
  278|      2|#define CPUID_STD_SSE               (1<<25)
  279|      2|#define CPUID_STD_SSE2              (1<<26)
  280|      2|#define CPUID_STD_HTT               (1<<28)     // EDX[28] - Bit 28 set indicates  Hyper-Threading Technology is supported in hardware.
  281|       |
  282|      2|#define CPUID_STD_SSE3              (1<<0)      // ECX[0]  - Bit 0 of standard function 1 indicate SSE3 supported
  283|      2|#define CPUID_STD_SSE41             (1<<19)     // ECX[19] - Bit 0 of standard function 1 indicate SSE41 supported
  284|      2|#define CPUID_STD_SSE42             (1<<20)     // ECX[20] - Bit 0 of standard function 1 indicate SSE42 supported
  285|       |
  286|      2|#define CPUID_FAMILY_ID_MASK        0x0F00      // EAX[11:8] - Bit 11 thru 8 contains family  processor id
  287|      2|#define CPUID_EXT_FAMILY_ID_MASK    0x0F00000   // EAX[23:20] - Bit 23 thru 20 contains extended family processor id
  288|      2|#define CPUID_PENTIUM4_ID           0x0F00      // Pentium 4 family processor id
  289|       |
  290|      2|#define CPUID_EXT_3DNOW             (1<<31)
  291|      2|#define CPUID_EXT_AMD_3DNOWEXT      (1<<30)
  292|      2|#define CPUID_EXT_AMD_MMXEXT        (1<<22)
  293|       |
  294|       |
  295|      2|#define CPUID_APM_INVARIANT_TSC     (1<<8)      // EDX[8] - Bit 8 of function 0x80000007 indicates support for invariant TSC.
  296|       |
  297|      2|        uint features = 0;
  298|       |
  299|       |        // Supports CPUID instruction ?
  300|      2|        if (_isSupportCpuid())
  ------------------
  |  Branch (300:13): [True: 2, False: 0]
  ------------------
  301|      2|        {
  302|      2|            CpuidResult result;
  303|       |
  304|       |            // Has standard feature ?
  305|      2|            if (_performCpuid(CPUID_FUNC_VENDOR_ID, result))
  ------------------
  |  |  268|      2|#define CPUID_FUNC_VENDOR_ID                 0x0
  ------------------
  |  Branch (305:17): [True: 2, False: 0]
  ------------------
  306|      2|            {
  307|       |                // Check vendor strings
  308|      2|                if (memcmp(&result._ebx, "GenuineIntel", 12) == 0)
  ------------------
  |  Branch (308:21): [True: 0, False: 2]
  ------------------
  309|      0|                {
  310|      0|                    if (result._eax > 2)
  ------------------
  |  Branch (310:25): [True: 0, False: 0]
  ------------------
  311|      0|                        features |= PlatformInformation::CPU_FEATURE_PRO;
  312|       |
  313|       |                    // Check standard feature
  314|      0|                    _performCpuid(CPUID_FUNC_STANDARD_FEATURES, result);
  ------------------
  |  |  269|      0|#define CPUID_FUNC_STANDARD_FEATURES         0x1
  ------------------
  315|       |
  316|      0|                    if (result._edx & CPUID_STD_FPU)
  ------------------
  |  |  274|      0|#define CPUID_STD_FPU               (1<<0)
  ------------------
  |  Branch (316:25): [True: 0, False: 0]
  ------------------
  317|      0|                        features |= PlatformInformation::CPU_FEATURE_FPU;
  318|      0|                    if (result._edx & CPUID_STD_TSC)
  ------------------
  |  |  275|      0|#define CPUID_STD_TSC               (1<<4)
  ------------------
  |  Branch (318:25): [True: 0, False: 0]
  ------------------
  319|      0|                        features |= PlatformInformation::CPU_FEATURE_TSC;
  320|      0|                    if (result._edx & CPUID_STD_CMOV)
  ------------------
  |  |  276|      0|#define CPUID_STD_CMOV              (1<<15)
  ------------------
  |  Branch (320:25): [True: 0, False: 0]
  ------------------
  321|      0|                        features |= PlatformInformation::CPU_FEATURE_CMOV;
  322|      0|                    if (result._edx & CPUID_STD_MMX)
  ------------------
  |  |  277|      0|#define CPUID_STD_MMX               (1<<23)
  ------------------
  |  Branch (322:25): [True: 0, False: 0]
  ------------------
  323|      0|                        features |= PlatformInformation::CPU_FEATURE_MMX;
  324|      0|                    if (result._edx & CPUID_STD_SSE)
  ------------------
  |  |  278|      0|#define CPUID_STD_SSE               (1<<25)
  ------------------
  |  Branch (324:25): [True: 0, False: 0]
  ------------------
  325|      0|                        features |= PlatformInformation::CPU_FEATURE_MMXEXT | PlatformInformation::CPU_FEATURE_SSE;
  326|      0|                    if (result._edx & CPUID_STD_SSE2)
  ------------------
  |  |  279|      0|#define CPUID_STD_SSE2              (1<<26)
  ------------------
  |  Branch (326:25): [True: 0, False: 0]
  ------------------
  327|      0|                        features |= PlatformInformation::CPU_FEATURE_SSE2;
  328|      0|                    if (result._ecx & CPUID_STD_SSE3)
  ------------------
  |  |  282|      0|#define CPUID_STD_SSE3              (1<<0)      // ECX[0]  - Bit 0 of standard function 1 indicate SSE3 supported
  ------------------
  |  Branch (328:25): [True: 0, False: 0]
  ------------------
  329|      0|                        features |= PlatformInformation::CPU_FEATURE_SSE3;
  330|      0|                    if (result._ecx & CPUID_STD_SSE41)
  ------------------
  |  |  283|      0|#define CPUID_STD_SSE41             (1<<19)     // ECX[19] - Bit 0 of standard function 1 indicate SSE41 supported
  ------------------
  |  Branch (330:25): [True: 0, False: 0]
  ------------------
  331|      0|                        features |= PlatformInformation::CPU_FEATURE_SSE41;
  332|      0|                    if (result._ecx & CPUID_STD_SSE42)
  ------------------
  |  |  284|      0|#define CPUID_STD_SSE42             (1<<20)     // ECX[20] - Bit 0 of standard function 1 indicate SSE42 supported
  ------------------
  |  Branch (332:25): [True: 0, False: 0]
  ------------------
  333|      0|                        features |= PlatformInformation::CPU_FEATURE_SSE42;
  334|       |
  335|       |                    // Check to see if this is a Pentium 4 or later processor
  336|      0|                    if ((result._eax & CPUID_EXT_FAMILY_ID_MASK) ||
  ------------------
  |  |  287|      0|#define CPUID_EXT_FAMILY_ID_MASK    0x0F00000   // EAX[23:20] - Bit 23 thru 20 contains extended family processor id
  ------------------
  |  Branch (336:25): [True: 0, False: 0]
  ------------------
  337|      0|                        (result._eax & CPUID_FAMILY_ID_MASK) == CPUID_PENTIUM4_ID)
  ------------------
  |  |  286|      0|#define CPUID_FAMILY_ID_MASK        0x0F00      // EAX[11:8] - Bit 11 thru 8 contains family  processor id
  ------------------
                                      (result._eax & CPUID_FAMILY_ID_MASK) == CPUID_PENTIUM4_ID)
  ------------------
  |  |  288|      0|#define CPUID_PENTIUM4_ID           0x0F00      // Pentium 4 family processor id
  ------------------
  |  Branch (337:25): [True: 0, False: 0]
  ------------------
  338|      0|                    {
  339|       |                        // Check hyper-threading technology
  340|      0|                        if (result._edx & CPUID_STD_HTT)
  ------------------
  |  |  280|      0|#define CPUID_STD_HTT               (1<<28)     // EDX[28] - Bit 28 set indicates  Hyper-Threading Technology is supported in hardware.
  ------------------
  |  Branch (340:29): [True: 0, False: 0]
  ------------------
  341|      0|                            features |= PlatformInformation::CPU_FEATURE_HTT;
  342|      0|                    }
  343|       |
  344|       |
  345|      0|                    const uint maxExtensionFunctionSupport = _performCpuid(CPUID_FUNC_EXTENSION_QUERY, result);
  ------------------
  |  |  270|      0|#define CPUID_FUNC_EXTENSION_QUERY           0x80000000
  ------------------
  346|      0|                    if (maxExtensionFunctionSupport >= CPUID_FUNC_ADVANCED_POWER_MANAGEMENT)
  ------------------
  |  |  272|      0|#define CPUID_FUNC_ADVANCED_POWER_MANAGEMENT 0x80000007
  ------------------
  |  Branch (346:25): [True: 0, False: 0]
  ------------------
  347|      0|                    {
  348|      0|                        _performCpuid(CPUID_FUNC_ADVANCED_POWER_MANAGEMENT, result);
  ------------------
  |  |  272|      0|#define CPUID_FUNC_ADVANCED_POWER_MANAGEMENT 0x80000007
  ------------------
  349|       |
  350|      0|                        if (result._edx & CPUID_APM_INVARIANT_TSC)
  ------------------
  |  |  295|      0|#define CPUID_APM_INVARIANT_TSC     (1<<8)      // EDX[8] - Bit 8 of function 0x80000007 indicates support for invariant TSC.
  ------------------
  |  Branch (350:29): [True: 0, False: 0]
  ------------------
  351|      0|                            features |= PlatformInformation::CPU_FEATURE_INVARIANT_TSC;
  352|      0|                    }
  353|      0|                }
  354|      2|                else if (memcmp(&result._ebx, "AuthenticAMD", 12) == 0)
  ------------------
  |  Branch (354:26): [True: 2, False: 0]
  ------------------
  355|      2|                {
  356|      2|                    features |= PlatformInformation::CPU_FEATURE_PRO;
  357|       |
  358|       |                    // Check standard feature
  359|      2|                    _performCpuid(CPUID_FUNC_STANDARD_FEATURES, result);
  ------------------
  |  |  269|      2|#define CPUID_FUNC_STANDARD_FEATURES         0x1
  ------------------
  360|       |
  361|      2|                    if (result._edx & CPUID_STD_FPU)
  ------------------
  |  |  274|      2|#define CPUID_STD_FPU               (1<<0)
  ------------------
  |  Branch (361:25): [True: 2, False: 0]
  ------------------
  362|      2|                        features |= PlatformInformation::CPU_FEATURE_FPU;
  363|      2|                    if (result._edx & CPUID_STD_TSC)
  ------------------
  |  |  275|      2|#define CPUID_STD_TSC               (1<<4)
  ------------------
  |  Branch (363:25): [True: 2, False: 0]
  ------------------
  364|      2|                        features |= PlatformInformation::CPU_FEATURE_TSC;
  365|      2|                    if (result._edx & CPUID_STD_CMOV)
  ------------------
  |  |  276|      2|#define CPUID_STD_CMOV              (1<<15)
  ------------------
  |  Branch (365:25): [True: 2, False: 0]
  ------------------
  366|      2|                        features |= PlatformInformation::CPU_FEATURE_CMOV;
  367|      2|                    if (result._edx & CPUID_STD_MMX)
  ------------------
  |  |  277|      2|#define CPUID_STD_MMX               (1<<23)
  ------------------
  |  Branch (367:25): [True: 2, False: 0]
  ------------------
  368|      2|                        features |= PlatformInformation::CPU_FEATURE_MMX;
  369|      2|                    if (result._edx & CPUID_STD_SSE)
  ------------------
  |  |  278|      2|#define CPUID_STD_SSE               (1<<25)
  ------------------
  |  Branch (369:25): [True: 2, False: 0]
  ------------------
  370|      2|                        features |= PlatformInformation::CPU_FEATURE_SSE;
  371|      2|                    if (result._edx & CPUID_STD_SSE2)
  ------------------
  |  |  279|      2|#define CPUID_STD_SSE2              (1<<26)
  ------------------
  |  Branch (371:25): [True: 2, False: 0]
  ------------------
  372|      2|                        features |= PlatformInformation::CPU_FEATURE_SSE2;
  373|       |
  374|      2|                    if (result._ecx & CPUID_STD_SSE3)
  ------------------
  |  |  282|      2|#define CPUID_STD_SSE3              (1<<0)      // ECX[0]  - Bit 0 of standard function 1 indicate SSE3 supported
  ------------------
  |  Branch (374:25): [True: 2, False: 0]
  ------------------
  375|      2|                        features |= PlatformInformation::CPU_FEATURE_SSE3;
  376|       |
  377|       |                    // Has extended feature ?
  378|      2|                    const uint maxExtensionFunctionSupport = _performCpuid(CPUID_FUNC_EXTENSION_QUERY, result);
  ------------------
  |  |  270|      2|#define CPUID_FUNC_EXTENSION_QUERY           0x80000000
  ------------------
  379|      2|                    if (maxExtensionFunctionSupport >= CPUID_FUNC_EXTENDED_FEATURES)
  ------------------
  |  |  271|      2|#define CPUID_FUNC_EXTENDED_FEATURES         0x80000001
  ------------------
  |  Branch (379:25): [True: 2, False: 0]
  ------------------
  380|      2|                    {
  381|       |                        // Check extended feature
  382|      2|                        _performCpuid(CPUID_FUNC_EXTENDED_FEATURES, result);
  ------------------
  |  |  271|      2|#define CPUID_FUNC_EXTENDED_FEATURES         0x80000001
  ------------------
  383|       |
  384|      2|                        if (result._edx & CPUID_EXT_3DNOW)
  ------------------
  |  |  290|      2|#define CPUID_EXT_3DNOW             (1<<31)
  ------------------
  |  Branch (384:29): [True: 0, False: 2]
  ------------------
  385|      0|                            features |= PlatformInformation::CPU_FEATURE_3DNOW;
  386|      2|                        if (result._edx & CPUID_EXT_AMD_3DNOWEXT)
  ------------------
  |  |  291|      2|#define CPUID_EXT_AMD_3DNOWEXT      (1<<30)
  ------------------
  |  Branch (386:29): [True: 0, False: 2]
  ------------------
  387|      0|                            features |= PlatformInformation::CPU_FEATURE_3DNOWEXT;
  388|      2|                        if (result._edx & CPUID_EXT_AMD_MMXEXT)
  ------------------
  |  |  292|      2|#define CPUID_EXT_AMD_MMXEXT        (1<<22)
  ------------------
  |  Branch (388:29): [True: 2, False: 0]
  ------------------
  389|      2|                            features |= PlatformInformation::CPU_FEATURE_MMXEXT;
  390|      2|                    }
  391|       |
  392|       |
  393|      2|                    if (maxExtensionFunctionSupport >= CPUID_FUNC_ADVANCED_POWER_MANAGEMENT)
  ------------------
  |  |  272|      2|#define CPUID_FUNC_ADVANCED_POWER_MANAGEMENT 0x80000007
  ------------------
  |  Branch (393:25): [True: 2, False: 0]
  ------------------
  394|      2|                    {
  395|      2|                        _performCpuid(CPUID_FUNC_ADVANCED_POWER_MANAGEMENT, result);
  ------------------
  |  |  272|      2|#define CPUID_FUNC_ADVANCED_POWER_MANAGEMENT 0x80000007
  ------------------
  396|       |
  397|      2|                        if (result._edx & CPUID_APM_INVARIANT_TSC)
  ------------------
  |  |  295|      2|#define CPUID_APM_INVARIANT_TSC     (1<<8)      // EDX[8] - Bit 8 of function 0x80000007 indicates support for invariant TSC.
  ------------------
  |  Branch (397:29): [True: 2, False: 0]
  ------------------
  398|      2|                            features |= PlatformInformation::CPU_FEATURE_INVARIANT_TSC;
  399|      2|                    }
  400|      2|                }
  401|      2|            }
  402|      2|        }
  403|       |
  404|      2|        return features;
  405|      2|    }
OgrePlatformInformation.cpp:_ZN4OgreL31_checkOperatingSystemSupportSSEEv:
  202|      2|    {
  203|       |#if OGRE_COMPILER == OGRE_COMPILER_MSVC
  204|       |        /*
  205|       |            The FP part of SSE introduces a new architectural state and therefore
  206|       |            requires support from the operating system. So even if CPUID indicates
  207|       |            support for SSE FP, the application might not be able to use it. If
  208|       |            CPUID indicates support for SSE FP, check here whether it is also
  209|       |            supported by the OS, and turn off the SSE FP feature bit if there
  210|       |            is no OS support for SSE FP.
  211|       |
  212|       |            Operating systems that do not support SSE FP return an illegal
  213|       |            instruction exception if execution of an SSE FP instruction is performed.
  214|       |            Here, a sample SSE FP instruction is executed, and is checked for an
  215|       |            exception using the (non-standard) __try/__except mechanism
  216|       |            of Microsoft Visual C/C++.
  217|       |        */
  218|       |        // Visual Studio 2005, Both AMD and Intel x64 support SSE
  219|       |        // note that even though this is a build rather than runtime setting, all
  220|       |        // 64-bit CPUs support this so since binary is 64-bit only we're ok
  221|       |    #if _MSC_VER >= 1400 && defined(_M_X64)
  222|       |            return true;
  223|       |    #else
  224|       |        __try
  225|       |        {
  226|       |            __asm orps  xmm0, xmm0
  227|       |            return true;
  228|       |        }
  229|       |        __except(EXCEPTION_EXECUTE_HANDLER)
  230|       |        {
  231|       |            return false;
  232|       |        }
  233|       |    #endif
  234|       |#elif (OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG) && OGRE_PLATFORM != OGRE_PLATFORM_EMSCRIPTEN
  235|       |        #if OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_64 
  236|      2|            return true;
  237|       |        #else
  238|       |        // Does gcc have __try/__except similar mechanism?
  239|       |        // Use signal, setjmp/longjmp instead.
  240|       |        void (*oldHandler)(int);
  241|       |        oldHandler = signal(SIGILL, _illegalHandler);
  242|       |
  243|       |        if (setjmp(sIllegalJmpBuf))
  244|       |        {
  245|       |            signal(SIGILL, oldHandler);
  246|       |            return false;
  247|       |        }
  248|       |        else
  249|       |        {
  250|       |            __asm__ __volatile__ ("orps %xmm0, %xmm0");
  251|       |            signal(SIGILL, oldHandler);
  252|       |            return true;
  253|       |        }
  254|       |       #endif
  255|       |#else
  256|       |        // TODO: Supports other compiler, assumed is supported by default
  257|       |        return true;
  258|       |#endif
  259|      2|    }
OgrePlatformInformation.cpp:_ZN4OgreL15_isSupportCpuidEv:
   83|      4|    {
   84|       |#if OGRE_COMPILER == OGRE_COMPILER_MSVC
   85|       |        // Visual Studio 2005 & 64-bit compilers always supports __cpuid intrinsic
   86|       |        // note that even though this is a build rather than runtime setting, all
   87|       |        // 64-bit CPUs support this so since binary is 64-bit only we're ok
   88|       |    #if _MSC_VER >= 1400 && defined(_M_X64)
   89|       |        return true;
   90|       |    #else
   91|       |        // If we can modify flag register bit 21, the cpu is supports CPUID instruction
   92|       |        __asm
   93|       |        {
   94|       |            // Read EFLAG
   95|       |            pushfd
   96|       |            pop     eax
   97|       |            mov     ecx, eax
   98|       |
   99|       |            // Modify bit 21
  100|       |            xor     eax, 0x200000
  101|       |            push    eax
  102|       |            popfd
  103|       |
  104|       |            // Read back EFLAG
  105|       |            pushfd
  106|       |            pop     eax
  107|       |
  108|       |            // Restore EFLAG
  109|       |            push    ecx
  110|       |            popfd
  111|       |
  112|       |            // Check bit 21 modifiable
  113|       |            xor     eax, ecx
  114|       |            neg     eax
  115|       |            sbb     eax, eax
  116|       |
  117|       |            // Return values in eax, no return statement requirement here for VC.
  118|       |        }
  119|       |    #endif
  120|       |#elif (OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG) && OGRE_PLATFORM != OGRE_PLATFORM_EMSCRIPTEN
  121|       |        #if OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_64
  122|      4|           return true;
  123|       |       #else
  124|       |        unsigned oldFlags, newFlags;
  125|       |        __asm__
  126|       |        (
  127|       |            "pushfl         \n\t"
  128|       |            "pop    %0      \n\t"
  129|       |            "mov    %0, %1  \n\t"
  130|       |            "xor    %2, %0  \n\t"
  131|       |            "push   %0      \n\t"
  132|       |            "popfl          \n\t"
  133|       |            "pushfl         \n\t"
  134|       |            "pop    %0      \n\t"
  135|       |            "push   %1      \n\t"
  136|       |            "popfl          \n\t"
  137|       |            : "=r" (oldFlags), "=r" (newFlags)
  138|       |            : "n" (0x200000)
  139|       |        );
  140|       |        return oldFlags != newFlags;
  141|       |       #endif // 64
  142|       |#else
  143|       |        // TODO: Supports other compiler
  144|       |        return false;
  145|       |#endif
  146|      4|    }

_ZN4Ogre16StreamSerialiserC2ERKNS_9SharedPtrINS_10DataStreamEEENS0_6EndianEbNS0_17RealStorageFormatE:
  109|    246|        : mStream(stream)
  110|    246|        , mEndian(endianMode)
  111|    246|        , mFlipEndian(false)
  112|    246|        , mReadWriteHeader(autoHeader)
  113|    246|        , mRealFormat(realFormat)
  114|    246|    {
  115|    246|        if (mEndian != ENDIAN_AUTO)
  ------------------
  |  Branch (115:13): [True: 0, False: 246]
  ------------------
  116|      0|        {
  117|       |#if OGRE_ENDIAN == OGRE_ENDIAN_BIG
  118|       |            if (mEndian == ENDIAN_LITTLE)
  119|       |                mFlipEndian = true;
  120|       |#else
  121|      0|            if (mEndian == ENDIAN_BIG)
  ------------------
  |  Branch (121:17): [True: 0, False: 0]
  ------------------
  122|      0|                mFlipEndian = true;
  123|      0|#endif
  124|       |
  125|      0|        }
  126|       |
  127|       |        OgreAssert(mStream, "Stream is null");
  ------------------
  |  Branch (127:9): [True: 0, False: 246]
  ------------------
  128|    246|    }
_ZN4Ogre16StreamSerialiserD2Ev:
  131|    246|    {
  132|       |        // really this should be empty if read/write was complete, but be tidy
  133|    246|        if (!mChunkStack.empty())
  ------------------
  |  Branch (133:13): [True: 0, False: 246]
  ------------------
  134|      0|        {
  135|      0|            LogManager::getSingleton().stream(LML_WARNING) <<
  136|      0|                "Warning: stream " << mStream->getName() << " was not fully read / written; " <<
  137|      0|                mChunkStack.size() << " chunks remain unterminated.";
  138|      0|        }
  139|    246|        for (auto & i : mChunkStack)
  ------------------
  |  Branch (139:23): [True: 0, False: 246]
  ------------------
  140|      0|            delete i;
  141|    246|        mChunkStack.clear();
  142|       |
  143|    246|    }
_ZN4Ogre16StreamSerialiser14makeIdentifierERA5_Kc:
  146|      2|    {
  147|      2|        uint32 ret = 0;
  148|     10|        for (size_t i = 0; i < 4; ++i)
  ------------------
  |  Branch (148:28): [True: 8, False: 2]
  ------------------
  149|      8|        {
  150|      8|            ret += (code[i] << (i * 8));
  151|      8|        }
  152|      2|        return ret;
  153|       |
  154|      2|    }
_ZN4Ogre16StreamSerialiser14readChunkBeginEv:
  165|    400|    {
  166|       |        // Have we figured out the endian mode yet?
  167|    400|        if (mReadWriteHeader)
  ------------------
  |  Branch (167:13): [True: 246, False: 154]
  ------------------
  168|    246|            readHeader();
  169|       |
  170|    400|        OgreAssert(mEndian != ENDIAN_AUTO,
  ------------------
  |  Branch (170:9): [True: 0, False: 400]
  ------------------
  171|    400|                   "Endian mode has not been determined, did you disable header without setting?");
  172|       |
  173|    400|        Chunk* chunk = readChunkImpl();
  174|    400|        mChunkStack.push_back(chunk);
  175|       |
  176|    400|        return chunk;
  177|       |
  178|    400|    }
_ZN4Ogre16StreamSerialiser12readChunkEndEj:
  239|     84|    {
  240|     84|        Chunk* c = popChunk(id);
  241|       |
  242|     84|        OgreAssert(mStream, "Stream is null");
  ------------------
  |  Branch (242:9): [True: 0, False: 84]
  ------------------
  243|       |
  244|       |        // skip to the end of the chunk if we were not there already
  245|       |        // this lets us quite reading a chunk anywhere and have the read marker
  246|       |        // automatically skip to the next one
  247|     84|        if (mStream->tell() < (c->offset + CHUNK_HEADER_SIZE + c->length))
  ------------------
  |  Branch (247:13): [True: 34, False: 50]
  ------------------
  248|     34|            mStream->seek(c->offset + CHUNK_HEADER_SIZE + c->length);
  249|       |
  250|       |        OGRE_DELETE c;
  251|     84|    }
_ZN4Ogre16StreamSerialiser10readHeaderEv:
  261|    246|    {
  262|    246|        uint32 headerid = 0;
  263|    246|        size_t actually_read = mStream->read(&headerid, sizeof(uint32));
  264|       |        // skip back
  265|    246|        mStream->skip(0 - (long)actually_read);
  266|       |        // validate that this is a header chunk
  267|    246|        if (headerid == REVERSE_HEADER_ID)
  ------------------
  |  Branch (267:13): [True: 16, False: 230]
  ------------------
  268|     16|        {
  269|     16|            mFlipEndian = true;
  270|     16|        }
  271|    230|        else if (headerid == HEADER_ID)
  ------------------
  |  Branch (271:18): [True: 138, False: 92]
  ------------------
  272|    138|        {
  273|    138|            mFlipEndian = false;
  274|    138|        }
  275|     92|        else
  276|     92|        {
  277|       |            // no good
  278|     92|            OGRE_EXCEPT(Exception::ERR_INVALID_STATE, 
  279|     92|                "Cannot determine endian mode because header is missing", 
  280|     92|                "StreamSerialiser::readHeader");
  281|     92|        }
  282|    154|        determineEndianness();
  283|       |
  284|    154|        mReadWriteHeader = false;
  285|       |
  286|    154|        const Chunk* c = readChunkBegin();
  287|       |        // endian should be flipped now
  288|    154|        assert(c->id == HEADER_ID);
  289|    154|        (void)c; // Silence warning
  290|       |
  291|       |        // read real storage format
  292|    154|        bool realIsDouble;
  293|    154|        read(&realIsDouble);
  294|    154|        mRealFormat = realIsDouble? REAL_DOUBLE : REAL_FLOAT;
  ------------------
  |  Branch (294:23): [True: 5, False: 149]
  ------------------
  295|       |
  296|    154|        readChunkEnd(HEADER_ID);
  297|       |
  298|    154|    }
_ZN4Ogre16StreamSerialiser19determineEndiannessEv:
  301|    154|    {
  302|       |#if OGRE_ENDIAN == OGRE_ENDIAN_BIG
  303|       |        if (mFlipEndian)
  304|       |            mEndian = ENDIAN_LITTLE;
  305|       |        else
  306|       |            mEndian = ENDIAN_BIG;
  307|       |#else
  308|    154|        if (mFlipEndian)
  ------------------
  |  Branch (308:13): [True: 16, False: 138]
  ------------------
  309|     16|            mEndian = ENDIAN_BIG;
  310|    138|        else
  311|    138|            mEndian = ENDIAN_LITTLE;
  312|    154|#endif
  313|    154|    }
_ZNK4Ogre16StreamSerialiser11checkStreamEbbb:
  330|    951|    {
  331|    951|        OgreAssert(mStream, "Stream is null");
  ------------------
  |  Branch (331:9): [True: 0, False: 951]
  ------------------
  332|       |
  333|    951|        if (failOnEof && mStream->eof())
  ------------------
  |  Branch (333:13): [True: 951, False: 0]
  |  Branch (333:26): [True: 47, False: 904]
  ------------------
  334|    951|            OGRE_EXCEPT(Exception::ERR_INVALID_STATE, "Invalid operation, end of file on stream");
  335|       |
  336|    904|        if (validateReadable && !mStream->isReadable())
  ------------------
  |  Branch (336:13): [True: 904, False: 0]
  |  Branch (336:33): [True: 0, False: 904]
  ------------------
  337|    904|            OGRE_EXCEPT(Exception::ERR_INVALID_STATE, "Invalid operation, file is not readable");
  338|       |
  339|    904|        if (validateWriteable && !mStream->isWriteable())
  ------------------
  |  Branch (339:13): [True: 0, False: 904]
  |  Branch (339:34): [True: 0, False: 0]
  ------------------
  340|       |            OGRE_EXCEPT(Exception::ERR_INVALID_STATE, "Invalid operation, file is not writeable");
  341|    904|    }
_ZN4Ogre16StreamSerialiser13readChunkImplEv:
  421|    238|    {
  422|    238|        auto chunk = std::make_unique<Chunk>();
  423|    238|        chunk->offset = static_cast<uint32>(mStream->tell());
  424|    238|        read(&chunk->id);
  425|    238|        read(&chunk->version);
  426|    238|        read(&chunk->length);
  427|       |        
  428|    238|        uint32 checksum;
  429|    238|        read(&checksum);
  430|       |        
  431|    238|        if (checksum != calculateChecksum(chunk.get()))
  ------------------
  |  Branch (431:13): [True: 107, False: 131]
  ------------------
  432|    107|        {
  433|       |            // no good, this is an invalid chunk
  434|    107|            uint32 off = chunk->offset;
  435|    107|            OGRE_EXCEPT(Exception::ERR_INVALID_STATE, 
  436|    107|                "Corrupt chunk detected in stream " + mStream->getName() + " at byte "
  437|    107|                + StringConverter::toString(off), 
  438|    107|                "StreamSerialiser::readChunkImpl");
  439|    107|        }
  440|       |
  441|    131|        return chunk.release();
  442|       |
  443|       |
  444|    238|    }
_ZN4Ogre16StreamSerialiser8readDataEPvmm:
  614|    951|    {
  615|    951|        checkStream(true, true, false);
  616|       |
  617|    951|        size_t totSize = size * count;
  618|    951|        mStream->read(buf, totSize);
  619|       |
  620|    951|        if (mFlipEndian)
  ------------------
  |  Branch (620:13): [True: 61, False: 890]
  ------------------
  621|     61|			Bitwise::bswapChunks(buf, size, count);
  622|       |
  623|    951|    }
_ZN4Ogre16StreamSerialiser4readEPbm:
  776|     84|    {
  777|    168|        for (size_t i = 0; i < count; ++i, ++val)
  ------------------
  |  Branch (777:28): [True: 84, False: 84]
  ------------------
  778|     84|        {
  779|     84|            char c;
  780|     84|            read(&c);
  781|     84|            *val = (c == 1);
  782|     84|        }
  783|     84|    }
_ZN4Ogre16StreamSerialiser17calculateChecksumEPNS0_5ChunkE:
  810|    191|    {
  811|       |        // Always calculate checksums in little endian to make sure they match 
  812|       |        // Otherwise checksums for the same data on different endians will not match
  813|    191|        uint32 id = c->id;
  814|    191|        uint16 version = c->version;
  815|    191|        uint32 length = c->length;
  816|       |#if OGRE_ENDIAN == OGRE_ENDIAN_BIG
  817|       |		Bitwise::bswapBuffer(&id, sizeof(uint32));
  818|       |		Bitwise::bswapBuffer(&version, sizeof(uint16));
  819|       |		Bitwise::bswapBuffer(&length, sizeof(uint32));
  820|       |#endif
  821|       |
  822|       |		// we cannot switch to murmur3 like everywhere else to allow loading legacy files
  823|    191|        uint32 hashVal = SuperFastHash((const char*)&id, sizeof(uint32), 0);
  824|    191|        hashVal = SuperFastHash((const char*)&version, sizeof(uint16), hashVal);
  825|    191|        hashVal = SuperFastHash((const char*)&length, sizeof(uint32), hashVal);
  826|       |
  827|    191|        return hashVal;
  828|    191|    }
_ZN4Ogre16StreamSerialiser8popChunkEj:
  831|     84|    {
  832|     84|        OgreAssert(!mChunkStack.empty(), "No active chunk!");
  ------------------
  |  Branch (832:9): [True: 0, False: 84]
  ------------------
  833|       |
  834|     84|        const Chunk* chunk = mChunkStack.back();
  835|     84|        OgreAssert(chunk->id == id, "Incorrect chunk id!");
  ------------------
  |  Branch (835:9): [True: 0, False: 84]
  ------------------
  836|       |
  837|     84|        Chunk* c = mChunkStack.back();
  838|     84|        mChunkStack.pop_back();
  839|     84|        return c;
  840|       |
  841|     84|    }
OgreStreamSerialiser.cpp:_ZN4OgreL13SuperFastHashEPKcij:
   40|    573|    {
   41|    573|#if OGRE_ENDIAN == OGRE_ENDIAN_LITTLE
   42|    573|#  define OGRE_GET16BITS(d) (*((const uint16 *) (d)))
   43|       |#else
   44|       |    // Cast to uint16 in little endian means first byte is least significant
   45|       |    // replicate that here
   46|       |#  define OGRE_GET16BITS(d) (*((const uint8 *) (d)) + (*((const uint8 *) (d+1))<<8))
   47|       |#endif
   48|    573|        uint32 hash;
   49|    573|        int rem;
   50|       |
   51|    573|        if (hashSoFar)
  ------------------
  |  Branch (51:13): [True: 380, False: 193]
  ------------------
   52|    380|            hash = hashSoFar;
   53|    193|        else
   54|    193|            hash = len;
   55|       |
   56|    573|        if (len <= 0 || data == NULL) return 0;
  ------------------
  |  Branch (56:13): [True: 0, False: 573]
  |  Branch (56:25): [True: 0, False: 573]
  ------------------
   57|       |
   58|    573|        rem = len & 3;
   59|    573|        len >>= 2;
   60|       |
   61|       |        /* Main loop */
   62|    955|        for (;len > 0; len--) {
  ------------------
  |  Branch (62:15): [True: 382, False: 573]
  ------------------
   63|    382|            hash  += OGRE_GET16BITS (data);
  ------------------
  |  |   42|    382|#  define OGRE_GET16BITS(d) (*((const uint16 *) (d)))
  ------------------
   64|    382|            uint32 tmp    = (OGRE_GET16BITS (data+2) << 11) ^ hash;
  ------------------
  |  |   42|    382|#  define OGRE_GET16BITS(d) (*((const uint16 *) (d)))
  ------------------
   65|    382|            hash   = (hash << 16) ^ tmp;
   66|    382|            data  += 2*sizeof (uint16);
   67|    382|            hash  += hash >> 11;
   68|    382|        }
   69|       |
   70|       |        /* Handle end cases */
   71|    573|        switch (rem) {
  ------------------
  |  Branch (71:17): [True: 191, False: 382]
  ------------------
   72|      0|        case 3: hash += OGRE_GET16BITS (data);
  ------------------
  |  |   42|      0|#  define OGRE_GET16BITS(d) (*((const uint16 *) (d)))
  ------------------
  |  Branch (72:9): [True: 0, False: 573]
  ------------------
   73|      0|            hash ^= hash << 16;
   74|      0|            hash ^= data[sizeof (uint16)] << 18;
   75|      0|            hash += hash >> 11;
   76|      0|            break;
   77|    191|        case 2: hash += OGRE_GET16BITS (data);
  ------------------
  |  |   42|    191|#  define OGRE_GET16BITS(d) (*((const uint16 *) (d)))
  ------------------
  |  Branch (77:9): [True: 191, False: 382]
  ------------------
   78|    191|            hash ^= hash << 11;
   79|    191|            hash += hash >> 17;
   80|    191|            break;
   81|      0|        case 1: hash += *data;
  ------------------
  |  Branch (81:9): [True: 0, False: 573]
  ------------------
   82|      0|            hash ^= hash << 10;
   83|      0|            hash += hash >> 1;
   84|    573|        }
   85|       |
   86|       |        /* Force "avalanching" of final 127 bits */
   87|    573|        hash ^= hash << 3;
   88|    573|        hash += hash >> 5;
   89|    573|        hash ^= hash << 4;
   90|    573|        hash += hash >> 17;
   91|    573|        hash ^= hash << 25;
   92|    573|        hash += hash >> 6;
   93|       |
   94|    573|        return hash;
   95|    573|#undef OGRE_GET16BITS
   96|    573|    }

_ZN4Ogre10StringUtil4trimERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbb:
   42|      2|    {
   43|       |        /*
   44|       |        size_t lspaces, rspaces, len = length(), i;
   45|       |
   46|       |        lspaces = rspaces = 0;
   47|       |
   48|       |        if( left )
   49|       |        {
   50|       |            // Find spaces / tabs on the left
   51|       |            for( i = 0;
   52|       |                i < len && ( at(i) == ' ' || at(i) == '\t' || at(i) == '\r');
   53|       |                ++lspaces, ++i );
   54|       |        }
   55|       |        
   56|       |        if( right && lspaces < len )
   57|       |        {
   58|       |            // Find spaces / tabs on the right
   59|       |            for( i = len - 1;
   60|       |                i >= 0 && ( at(i) == ' ' || at(i) == '\t' || at(i) == '\r');
   61|       |                rspaces++, i-- );
   62|       |        }
   63|       |
   64|       |        *this = substr(lspaces, len-lspaces-rspaces);
   65|       |        */
   66|      2|        static const String delims = " \t\r\n";
   67|      2|        if(right)
  ------------------
  |  Branch (67:12): [True: 2, False: 0]
  ------------------
   68|      2|            str.erase(str.find_last_not_of(delims)+1); // trim right
   69|      2|        if(left)
  ------------------
  |  Branch (69:12): [True: 2, False: 0]
  ------------------
   70|      2|            str.erase(0, str.find_first_not_of(delims)); // trim left
   71|      2|    }

_ZN4Ogre7SamplerC2Ev:
   40|      2|        : mBorderColour(ColourValue::Black)
   41|      2|        , mMaxAniso(1)
   42|      2|        , mMipmapBias(0)
   43|      2|        , mMinFilter(FO_LINEAR)
   44|      2|        , mMagFilter(FO_LINEAR)
   45|      2|        , mMipFilter(FO_POINT)
   46|      2|        , mCompareFunc(CMPF_GREATER_EQUAL)
   47|      2|        , mCompareEnabled(false)
   48|      2|        , mDirty(true)
   49|      2|    {
   50|      2|        setAddressingMode(TAM_WRAP);
   51|      2|    }
_ZN4Ogre7Sampler17setAddressingModeERKNS0_17UVWAddressingModeE:
   55|      2|    {
   56|      2|        mAddressMode = uvw;
   57|      2|        mDirty = true;
   58|      2|    }

LLVMFuzzerTestOneInput:
   30|    246|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   31|    246|  char filename[256];
   32|    246|  sprintf(filename, "/tmp/libfuzzer.%d", getpid());
   33|       |
   34|    246|  FILE *fp = fopen(filename, "wb");
   35|    246|  if (!fp) {
  ------------------
  |  Branch (35:7): [True: 0, False: 246]
  ------------------
   36|      0|    return 0;
   37|      0|  }
   38|    246|  fwrite(data, size, 1, fp);
   39|    246|  fclose(fp);
   40|       |
   41|    246|  Ogre::String fileName = filename;
   42|       |
   43|    246|  Ogre::FileSystemArchiveFactory factory;
   44|    246|  Ogre::Archive *arch = factory.createInstance("/tmp/", false);
   45|    246|  arch->load();
   46|       |
   47|    246|  Ogre::DataStreamPtr stream = arch->open(fileName);
   48|    246|  Ogre::StreamSerialiser serialiser(stream);
   49|    246|  try {
   50|    246|    const Ogre::StreamSerialiser::Chunk *c = serialiser.readChunkBegin();
   51|       |
   52|    246|    Ogre::Vector3 dest;
   53|    246|    serialiser.read(&dest, 1);
   54|    246|  } catch (Ogre::InvalidStateException) {
   55|    246|  }
   56|    246|  factory.destroyInstance(arch);
   57|    246|  unlink(filename);
   58|       |
   59|    246|  return 0;
   60|    246|}

