Changeset 421 for trunk/src


Ignore:
Timestamp:
07/16/15 11:59:00 (10 years ago)
Author:
epyon
Message:
  • move ops for data_channel_set
  • string_table works on string_views, stores hashes
Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/formats/md5_loader.cc

    r420 r421  
    520520        for ( uint32 i = 0; i < size; ++i )
    521521        {
    522                 data_channel_set_creator( m_meshes[i] ).move_to( meshes[i] );
     522                meshes[i] = move( *m_meshes[i] );
    523523                delete m_meshes[i];
    524524                m_meshes[i] = nullptr;
  • trunk/src/formats/nmd_loader.cc

    r420 r421  
    5858        for ( uint32 i = 0; i < size; ++i )
    5959        {
    60                 data_channel_set_creator( m_meshes[i] ).move_to( meshes[i] );
     60                meshes[i] = move( *m_meshes[i] );
    6161                delete m_meshes[i];
    6262        }
  • trunk/src/io/string_table.cc

    r406 r421  
    1212}
    1313
    14 nv::string_table_creator::index nv::string_table_creator::insert( const std::string& s )
     14nv::string_table_creator::index nv::string_table_creator::insert( const string_view& s )
    1515{
    16         auto i = m_map.find( s );
     16        uint64 hash_value = hash_string< uint64 >( s.data() );
     17        auto i = m_map.find( hash_value );
    1718        if ( i != m_map.end() )
    1819        {
    1920                return i->second;
    2021        }
    21         const char* cs = s.c_str();
     22        const char* cs = s.data();
    2223        uint32 cs_size = s.size() + 1;
    2324        NV_ASSERT( m_offsets.size() < index(-1), "Too many strings!" );
     
    2728        m_data.resize( dsize + cs_size );
    2829        raw_copy( cs, cs + cs_size, m_data.data() + dsize );
    29         m_map[ s ] = result;
     30        m_map[ hash_value ] = result;
    3031        return result;
    3132}
     
    5556}
    5657
    57 nv::string_table_creator::index nv::string_table_creator::get( const std::string& s ) const
     58nv::string_table_creator::index nv::string_table_creator::get( const string_view& s ) const
    5859{
    59         auto i = m_map.find( s );
     60        uint64 hash_value = hash_string< uint64 >( s.data() );
     61        auto i = m_map.find( hash_value );
    6062        if ( i != m_map.end() )
    6163        {
Note: See TracChangeset for help on using the changeset viewer.