Changeset 533 for trunk


Ignore:
Timestamp:
01/12/17 13:16:48 (8 years ago)
Author:
epyon
Message:
  • getting rid of size_t
  • datatypes now restricted to uint32 size
  • 64-bit compatibility
  • copyright updates where modified
Location:
trunk
Files:
48 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/base/capi.hh

    r471 r533  
    1 // Copyright (C) 2015 ChaosForge Ltd
     1// Copyright (C) 2015-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/base/common.hh

    r505 r533  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    162162#endif
    163163
    164 #define NV_COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / (static_cast<nv::size_t>(!(sizeof(x) % sizeof(0[x])))))
     164#define NV_COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / (static_cast<nv::uint32>(!(sizeof(x) % sizeof(0[x])))))
    165165#define NV_SAFE_ARRAY( arr, idx, def ) ( index < NV_COUNT_OF(arr) ? (arr)[idx] : (def) )
    166166
     
    292292        };
    293293
    294         using log_handler_t = void( *)( int, const char*, size_t );
     294        using log_handler_t = void( *)( int, const char*, uint32 );
    295295
    296296        log_handler_t get_log_handler();
     
    298298
    299299        template < typename T >
    300         constexpr size_t size( const T& t )
     300        constexpr uint32 size( const T& t )
    301301        {
    302302                return t.size();
    303303        }
    304304
    305         template < typename T, size_t N >
    306         constexpr size_t size( const T (&)[N] )
     305        template < typename T, uint32 N >
     306        constexpr uint32 size( const T (&)[N] )
    307307        {
    308308                return N;
     
    315315        }
    316316
    317         template < typename T, size_t N >
     317        template < typename T, uint32 N >
    318318        constexpr bool empty( const T(&)[N] )
    319319        {
     
    333333        }
    334334
    335         template < typename T, size_t N >
     335        template < typename T, uint32 N >
    336336        constexpr T* data( T(&array)[N] )
    337337        {
  • trunk/nv/common.hh

    r401 r533  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/core/logger.hh

    r399 r533  
    4343                * Optional timestamp string
    4444                */
    45                 size_t timestamp( char* buffer ) const;
     45                uint32 timestamp( char* buffer ) const;
    4646                /**
    4747                * Log level name (unpadded)
  • trunk/nv/core/logging.hh

    r435 r533  
    4040                void log_append( string_view ref )
    4141                {
    42                         size_t count = ::nv::min< size_t >( ref.size(), space_left()-1 );
     42                        uint32 count = ::nv::min< uint32 >( ref.size(), space_left()-1 );
    4343                        nvmemcpy( m_pos, ref.data(), count );
    4444                        m_pos += count;
     
    7272                {
    7373                        *m_pos = '\0';
    74                         log( level, string_view( m_message, static_cast<size_t>( m_pos - m_message ) ) );
     74                        log( level, string_view( m_message, static_cast<uint32>( m_pos - m_message ) ) );
    7575                        m_pos = m_message;
    7676                }
     
    8383                virtual ~logger_base() {}
    8484        protected:
    85                 inline size_t space_left() const
     85                inline uint32 space_left() const
    8686                {
    87                         return 1024 - static_cast< size_t >( m_pos - m_message );
     87                        return 1024 - static_cast< uint32 >( m_pos - m_message );
    8888                }
    8989
  • trunk/nv/core/types.hh

    r519 r533  
    1 // Copyright (C) 2014 Kornel Kisielewicz
     1// Copyright (C) 2014-2017 Kornel Kisielewicz
    22// http://chaosforge.org/
    33//
     
    9696                constructor_t      constructor; //!< Pointers to the constructor
    9797                destructor_t       destructor;  //!< Pointers to the destructor
    98                 size_t             size;        //!< Result of sizeof(type) operation
     98                uint32             size;        //!< Result of sizeof(type) operation
    9999                type_entry*        base_type;   //!< Base type
    100100                vector<type_field> field_list;  //!< Field list
  • trunk/nv/engine/light.hh

    r529 r533  
    8585                        uint32 count = nv::min< uint32 >( lights.size(), m_max_size );
    8686                        uint32 shadow_counter[4] = { 0, 0, 0, 0 };
    87                         for ( size_t i = 0; i < count; ++i )
     87                        for ( uint32 i = 0; i < count; ++i )
    8888                        {
    8989                                m_cameras[i].set_lookat( vec3(), vec3( lights[i]->direction ), vec3( 1.0f, 0.0f, 0.0f ) );
     
    149149                {
    150150                        uint32 count = nv::min< uint32 >( lights.size(), m_max_size );
    151                         for ( size_t i = 0; i < count; ++i )
     151                        for ( uint32 i = 0; i < count; ++i )
    152152                        {
    153153                                vec3 nlp = lights[i]->position;
  • trunk/nv/gfx/texture_atlas.hh

    r437 r533  
    2121        {
    2222        public:
    23                 texture_atlas( ivec2 size, size_t depth, size_t border = 1 );
     23                texture_atlas( ivec2 size, uint32 depth, uint32 border = 1 );
    2424                region get_region( ivec2 size );
    2525                void clear();
    26                 size_t get_used() const { return m_used; }
     26                uint32 get_used() const { return m_used; }
    2727        protected:
    28                 int fit( size_t index, ivec2 size );
     28                int fit( uint32 index, ivec2 size );
    2929                void merge();
    3030        private:
    31                 size_t m_used;
    32                 size_t m_border;
     31                uint32 m_used;
     32                uint32 m_border;
    3333                vector<ivec3> m_nodes;
    3434        };
  • trunk/nv/interface/mesh_data.hh

    r487 r533  
    2525        class child_list : noncopyable
    2626        {
    27                 static constexpr size_t MAX_CHILDREN = 7;
     27                static constexpr uint32 MAX_CHILDREN = 7;
    2828        public:
    2929                child_list() : m_size( 0 )
     
    7474                }
    7575
    76                 size_t size() const { return m_data.size(); }
     76                uint32 size() const { return m_data.size(); }
    7777                bool empty() const { return m_data.empty(); }
    7878
    79                 const data_node_info& operator[]( size_t i ) const
     79                const data_node_info& operator[]( uint32 i ) const
    8080                {
    8181                        return m_data[i];
     
    8585                {
    8686                        if ( size() != other.size() ) return false;
    87                         for ( size_t i = 0; i < size(); ++i )
     87                        for ( uint32 i = 0; i < size(); ++i )
    8888                                if ( m_data[i].name != other.m_data[i].name ) return false;
    8989                        return true;
     
    9292                sint16 resolve( shash64 name ) const
    9393                {
    94                         for ( size_t i = 0; i < size(); ++i )
     94                        for ( uint32 i = 0; i < size(); ++i )
    9595                                if ( m_data[i].name == name )
    9696                                        return sint16(i);
     
    128128                }
    129129
    130                 const child_list& children( size_t i ) const
     130                const child_list& children( uint32 i ) const
    131131                {
    132132                        return m_children[i];
     
    166166                }
    167167
    168                 const child_list& children( size_t i ) const
     168                const child_list& children( uint32 i ) const
    169169                {
    170170                        return m_info.children(i);
    171171                }
    172172
    173                 size_t size() const { return m_data.size(); }
     173                uint32 size() const { return m_data.size(); }
    174174                bool empty() const { return m_data.empty(); }
    175175
    176                 bool is_animated( size_t i ) const
     176                bool is_animated( uint32 i ) const
    177177                {
    178178                        if ( i >= m_data.size() ) return false;
     
    209209                }
    210210
    211                 const data_channel_set* operator[]( size_t i ) const
     211                const data_channel_set* operator[]( uint32 i ) const
    212212                {
    213213                        return m_data[i];
    214214                }
    215                 const data_node_info& get_info( size_t i ) const
     215                const data_node_info& get_info( uint32 i ) const
    216216                {
    217217                        return m_info[i];
  • trunk/nv/lib/curses.hh

    r395 r533  
    1 // Copyright (C) 2014-2015 ChaosForge Ltd
     1// Copyright (C) 2014-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    1414
    1515#if NV_PLATFORM == NV_WINDOWS
    16 #       define NV_CURSES_PATH "pdcurses.dll"
     16#       if NV_ARCHITECTURE == NV_64BIT
     17#               define NV_CURSES_PATH "pdcurses64.dll"
     18#       else
     19#               define NV_CURSES_PATH "pdcurses.dll"
     20#       endif
    1721#elif NV_PLATFORM == NV_APPLE
    1822#       define NV_CURSES_PATH ""
  • trunk/nv/lib/fmod.hh

    r395 r533  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    1414
    1515#if NV_PLATFORM == NV_WINDOWS
    16 #       define NV_FMOD_PATH "fmodex.dll"
     16#       if NV_ARCHITECTURE == NV_64BIT
     17#               define NV_FMOD_PATH "fmodex64.dll"
     18#       else
     19#               define NV_FMOD_PATH "fmodex.dll"
     20#       endif
    1721#elif NV_PLATFORM == NV_APPLE
    1822#       define NV_FMOD_PATH "fmodex.framework/fmodex"
  • trunk/nv/lib/freetype2.hh

    r406 r533  
    1818
    1919#if NV_PLATFORM == NV_WINDOWS
    20 #       define NV_FREETYPE_PATH "freetype6.dll"
     20#       if NV_ARCHITECTURE == NV_64BIT
     21#               define NV_FREETYPE_PATH "freetype6_64.dll"
     22#       else
     23#               define NV_FREETYPE_PATH "freetype6.dll"
     24#       endif
    2125#elif NV_PLATFORM == NV_APPLE
    2226#       define NV_FREETYPE_PATH "freetype.framework/freetype"
  • trunk/nv/lib/gl.hh

    r492 r533  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/lib/lua.hh

    r490 r533  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    4646
    4747#if NV_PLATFORM == NV_WINDOWS
    48 #       define NV_LUA_PATH_51  "lua51.dll"
    49 #       define NV_LUA_PATH_52  "lua52.dll"
    50 #       define NV_LUA_PATH_JIT "luajit.dll"
     48#       if NV_ARCHITECTURE == NV_64BIT
     49#               define NV_LUA_PATH_51  "lua51_64.dll"
     50#               define NV_LUA_PATH_52  "lua52_64.dll"
     51#               define NV_LUA_PATH_JIT "luajit_64.dll"
     52#       else
     53#               define NV_LUA_PATH_51  "lua51.dll"
     54#               define NV_LUA_PATH_52  "lua52.dll"
     55#               define NV_LUA_PATH_JIT "luajit.dll"
     56#       endif
    5157#elif NV_PLATFORM == NV_APPLE
    5258#       define NV_LUA_PATH_51  "lua5.1.dylib"
  • trunk/nv/lib/sdl.hh

    r395 r533  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    1414
    1515#if NV_PLATFORM == NV_WINDOWS
    16 #       define NV_SDL_PATH "SDL2.dll"
     16#       if NV_ARCHITECTURE == NV_64BIT
     17#               define NV_SDL_PATH "SDL2_64.dll"
     18#       else
     19#               define NV_SDL_PATH "SDL2.dll"
     20#       endif
    1721#elif NV_PLATFORM == NV_APPLE
    1822#       define NV_SDL_PATH "SDL2.framework/SDL"
  • trunk/nv/lib/sdl_image.hh

    r395 r533  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    1212
    1313#if NV_PLATFORM == NV_WINDOWS
    14 #       define NV_SDL_IMAGE_PATH "SDL2_image.dll"
     14#       if NV_ARCHITECTURE == NV_64BIT
     15#               define NV_SDL_IMAGE_PATH "SDL2_image_64.dll"
     16#       else
     17#               define NV_SDL_IMAGE_PATH "SDL2_image.dll"
     18#       endif
    1519#elif NV_PLATFORM == NV_APPLE
    1620#       define NV_SDL_IMAGE_PATH "SDL2_image.framework/SDL_image"
  • trunk/nv/lib/sdl_mixer.hh

    r395 r533  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    1212
    1313#if NV_PLATFORM == NV_WINDOWS
    14 #       define NV_SDL_MIXER_PATH "SDL2_mixer.dll"
     14#       if NV_ARCHITECTURE == NV_64BIT
     15#               define NV_SDL_MIXER_PATH "SDL2_mixer_64.dll"
     16#       else
     17#               define NV_SDL_MIXER_PATH "SDL2_mixer.dll"
     18#       endif
    1519#elif NV_PLATFORM == NV_APPLE
    1620#       define NV_SDL_MIXER_PATH "SDL2_mixer.framework/SDL_mixer"
  • trunk/nv/lua/lua_raw.hh

    r494 r533  
    3737        size_t len;
    3838        const char* str = lua_tolstring( L, idx, &len );
    39         return nv::string_view( str, len );
     39        return nv::string_view( str, static_cast< nv::uint32 >( len ) );
    4040}
    4141
  • trunk/nv/lua/lua_state.hh

    r515 r533  
    369369                        table_guard( const table_guard& parent, const path& p );
    370370                        virtual ~table_guard();
    371                         size_t get_size();
     371                        uint32 get_size();
    372372                       
    373373                        bool has_field( string_view element );
  • trunk/nv/stl/algorithm/heap.hh

    r472 r533  
    2525                template<
    2626                        typename RandomAccessIterator,
    27                         typename DifferenceType,
    2827                        typename T,
    2928                        typename Predicate
     
    3130                inline void push_heap_impl(
    3231                        RandomAccessIterator first,
    33                         DifferenceType pivot,
    34                         DifferenceType top,
     32                        ptrdiff_t pivot,
     33                        ptrdiff_t top,
    3534                        T&& value,
    3635                        Predicate pred
     
    3837                {
    3938                        for (
    40                                 DifferenceType index = ( pivot - 1 ) / 2;
     39                                ptrdiff_t index = ( pivot - 1 ) / 2;
    4140                                top < pivot && pred( *( first + index ), value );
    4241                                index = ( pivot - 1 ) / 2 )
     
    5150                template<
    5251                        typename RandomAccessIterator,
    53                         typename DifferenceType,
    5452                        typename T,
    5553                        typename Predicate
     
    5755                inline void fix_heap(
    5856                        RandomAccessIterator first,
    59                         DifferenceType pivot,
    60                         DifferenceType bottom,
     57                        ptrdiff_t pivot,
     58                        ptrdiff_t bottom,
    6159                        T&& value,
    6260                        Predicate pred
    6361                )
    6462                {
    65                         DifferenceType top = pivot;
    66                         DifferenceType index = 2 * pivot + 2;
     63                        ptrdiff_t top = pivot;
     64                        ptrdiff_t index = 2 * pivot + 2;
    6765                        for ( ; index < bottom; index = 2 * index + 2 )
    6866                        {
  • trunk/nv/stl/container/contiguous_storage.hh

    r438 r533  
    1 // Copyright (C) 2015 ChaosForge Ltd
     1// Copyright (C) 2015-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    2121{
    2222
    23         template< typename T, size_t N >
     23        template< typename T, uint32 N >
    2424        class static_storage
    2525        {
     
    3636
    3737        protected:
    38                 static constexpr bool reallocate( size_t new_size, bool /*copy_needed*/ ) { return new_size <= N; }
     38                static constexpr bool reallocate( uint32 new_size, bool /*copy_needed*/ ) { return new_size <= N; }
    3939
    4040                static_storage() = default;
     
    8989                ~dynamic_storage() = default;
    9090
    91                 bool reallocate( size_t new_size, bool copy_needed )
     91                bool reallocate( uint32 new_size, bool copy_needed )
    9292                {
    9393                        if ( copy_needed )
  • trunk/nv/stl/container/growing_storage.hh

    r487 r533  
    1 // Copyright (C) 2015 ChaosForge Ltd
     1// Copyright (C) 2015-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    3535        namespace detail
    3636        {
    37                 template < typename SizeType, size_t Capacity >
     37                template < typename SizeType, uint32 Capacity >
    3838                struct growing_storage_size
    3939                {
    40                         static constexpr size_t max_size() { return Capacity; }
    41                         static constexpr size_t capacity() { return Capacity; }
    42                         constexpr size_t size() const { return m_size; }
    43 
    44                         inline void size( size_t new_size ) { m_size = static_cast< SizeType >( new_size ); }
    45 
    46                         operator size_t( ) const { return m_size; }
     40                        static constexpr uint32 max_size() { return Capacity; }
     41                        static constexpr uint32 capacity() { return Capacity; }
     42                        constexpr uint32 size() const { return m_size; }
     43
     44                        inline void size( uint32 new_size ) { m_size = static_cast< SizeType >( new_size ); }
     45
     46                        operator uint32( ) const { return m_size; }
    4747
    4848                        SizeType m_size = 0;
     
    5252                struct growing_storage_size< SizeType, 0 >
    5353                {
    54                         static constexpr size_t max_size() { return size_t( 0x80000000 ); }
    55                         constexpr size_t capacity() const { return m_capacity; }
    56                         constexpr size_t size() const { return m_size; }
    57 
    58                         inline void capacity( size_t new_capacity ) { m_capacity = static_cast< SizeType >( new_capacity ); }
    59                         inline void size( size_t new_size ) { m_size = static_cast< SizeType >( new_size ); }
    60 
    61                         operator size_t() const { return m_size; }
     54                        static constexpr uint32 max_size() { return uint32( 0x80000000 ); }
     55                        constexpr uint32 capacity() const { return m_capacity; }
     56                        constexpr uint32 size() const { return m_size; }
     57
     58                        inline void capacity( uint32 new_capacity ) { m_capacity = static_cast< SizeType >( new_capacity ); }
     59                        inline void size( uint32 new_size ) { m_size = static_cast< SizeType >( new_size ); }
     60
     61                        operator uint32() const { return m_size; }
    6262
    6363                        SizeType m_size = 0;
     
    6969                typename Storage,
    7070                typename InitializePolicy = policy_initialize_standard,
    71                 typename SizeType = size_t,
    72                 size_t Capacity = 0,
    73                 typename NextCapacity = default_next_capacity< size_t >
     71                typename SizeType = uint32,
     72                uint32 Capacity = 0,
     73                typename NextCapacity = default_next_capacity< uint32 >
    7474        >
    7575        class growing_storage : public Storage
     
    7878                typedef detail::growing_storage_size< SizeType, Capacity > size_impl_type;
    7979                typedef typename Storage::value_type value_type;
    80                 typedef size_t                       size_type;
     80                typedef uint32                       size_type;
    8181                typedef SizeType                     size_store_type;
    8282                typedef value_type*                  iterator;
     
    298298                }
    299299
    300                 template< size_t C = Capacity >
    301                 enable_if_t< C != 0, bool > try_reallocate( size_t, bool )
     300                template< uint32 C = Capacity >
     301                enable_if_t< C != 0, bool > try_reallocate( uint32, bool )
    302302                {
    303303                        return false;
    304304                }
    305305
    306                 template< size_t C = Capacity >
    307                 enable_if_t< C == 0, bool > try_reallocate( size_t new_capacity, bool copy_needed )
     306                template< uint32 C = Capacity >
     307                enable_if_t< C == 0, bool > try_reallocate( uint32 new_capacity, bool copy_needed )
    308308                {
    309309                        if ( new_capacity > 0 && Storage::reallocate( new_capacity, copy_needed ) )
     
    316316
    317317                // TODO: return type error checking
    318                 bool try_grow( size_t amount, size_t extra = 0 )
     318                bool try_grow( uint32 amount, uint32 extra = 0 )
    319319                {
    320320                        size_type new_size = amount + m_size + extra;
     
    329329
    330330                // TODO: return type error checking
    331                 bool try_reserve( size_t new_capacity, bool copy_needed )
     331                bool try_reserve( uint32 new_capacity, bool copy_needed )
    332332                {
    333333                        if ( new_capacity > m_size.capacity() )
     
    338338                }
    339339                // TODO: return type error checking
    340                 bool try_resize( size_t new_size, bool copy_needed, size_t extra = 0 )
     340                bool try_resize( uint32 new_size, bool copy_needed, uint32 extra = 0 )
    341341                {
    342342                        if ( new_size > m_size )
  • trunk/nv/stl/container/hash_table.hh

    r532 r533  
    151151                typedef table_iterator< true >       const_iterator;
    152152
    153                 typedef size_t size_type;
     153                typedef uint32 size_type;
    154154                typedef node_type* bucket_type;
    155155
     
    160160                }
    161161
    162                 explicit hash_table_storage( size_t count )
     162                explicit hash_table_storage( uint32 count )
    163163                        : m_buckets( nullptr ), m_bucket_count( 0 ), m_element_count( 0 ), m_max_load_factor( 1.0f )
    164164                {
     
    301301                bool rehash_check( size_type new_elements )
    302302                {
    303                         size_t new_buckets = RehashPolicy::is_rehash_required( m_bucket_count, m_element_count + new_elements, m_max_load_factor );
     303                        uint32 new_buckets = RehashPolicy::is_rehash_required( m_bucket_count, m_element_count + new_elements, m_max_load_factor );
    304304                        if ( new_buckets )
    305305                        {
     
    365365                }
    366366
    367                 size_type bucket_index( hash_type hash_code, size_t b_count ) const
     367                size_type bucket_index( hash_type hash_code, uint32 b_count ) const
    368368                {
    369369                        return RehashPolicy::template get_index<hash_type>( hash_code, b_count );
     
    432432                typedef typename HashEntryPolicy::key_type    key_type;
    433433                typedef typename HashEntryPolicy::mapped_type mapped_type;
    434                 typedef size_t                                size_type;
     434                typedef uint32                                size_type;
    435435                typedef ptrdiff_t                             difference_type;
    436436                typedef value_type&                           reference;
  • trunk/nv/stl/container/hash_table_policy.hh

    r432 r533  
    145145        {
    146146                template< typename H >
    147                 static enable_if_t< is_integral< H >::value, size_t >
    148                 get_index( H h, size_t n ) { return h % n; }
     147                static enable_if_t< is_integral< H >::value, uint32 >
     148                get_index( H h, uint32 n ) { return h % n; }
    149149
    150150                template< typename H >
    151                 static enable_if_t< is_class< H >::value, size_t >
    152                 get_index( H h, size_t n ) { return h.value() % n; }
     151                static enable_if_t< is_class< H >::value, uint32 >
     152                get_index( H h, uint32 n ) { return h.value() % n; }
    153153
    154154
  • trunk/nv/stl/container/initialize_policy.hh

    r434 r533  
    1 // Copyright (C) 2015 ChaosForge Ltd
     1// Copyright (C) 2015-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/stl/container/random_access.hh

    r520 r533  
    1 // Copyright (C) 2015 ChaosForge Ltd
     1// Copyright (C) 2015-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    5959                inline const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); }
    6060                inline const_reverse_iterator crend() const { return const_reverse_iterator( begin() ); }
    61                 inline const_iterator iat( size_t i ) const { NV_ASSERT( i <= Super::size(), "Index out of range" ); return begin() + i; }
     61                inline const_iterator iat( uint32 i ) const { NV_ASSERT( i <= Super::size(), "Index out of range" ); return begin() + i; }
    6262        };
    6363
     
    114114                inline const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); }
    115115                inline const_reverse_iterator crend() const { return const_reverse_iterator( begin() ); }
    116                 inline const_iterator iat( size_t i ) const { NV_ASSERT( i <= Super::size(), "Index out of range" ); return begin() + i; }
    117                 inline iterator       iat( size_t i ) { NV_ASSERT( i <= Super::size(), "Index out of range" ); return begin() + i; }
     116                inline const_iterator iat( uint32 i ) const { NV_ASSERT( i <= Super::size(), "Index out of range" ); return begin() + i; }
     117                inline iterator       iat( uint32 i ) { NV_ASSERT( i <= Super::size(), "Index out of range" ); return begin() + i; }
    118118        };
    119119}
  • trunk/nv/stl/container/sized_storage.hh

    r435 r533  
    2323                typename Storage,
    2424                typename InitializePolicy = policy_initialize_standard,
    25                 typename SizeType = size_t
     25                typename SizeType = uint32
    2626        >
    2727        class sized_storage : public Storage
    2828        {
    2929        public:
    30                 typedef size_t                       size_type;
     30                typedef uint32                       size_type;
    3131                typedef SizeType                     size_store_type;
    3232                typedef typename Storage::value_type value_type;
     
    132132
    133133                // TODO: return type error checking
    134                 bool try_resize( size_t new_size, bool copy_needed )
     134                bool try_resize( uint32 new_size, bool copy_needed )
    135135                {
    136136                        if ( new_size != m_size )
  • trunk/nv/stl/functional/hash.hh

    r518 r533  
    5454                        }
    5555                        template < typename T >
    56                         static constexpr H hash( const T* p, size_t sz, H basis = hash_basis )
     56                        static constexpr H hash( const T* p, uint32 sz, H basis = hash_basis )
    5757                        {
    5858                                return p != nullptr ? hash_impl( reinterpret_cast<const char*>(p), sizeof(T)*sz, basis ) : 0;
     
    6363                                return c == 0 ? value : str_hash_impl( remain[0], remain + 1, static_cast<H>( value ^ static_cast<H>( c ) ) * hash_prime );
    6464                        }
    65                         static constexpr H hash_impl( const char* current, size_t remain, H value )
     65                        static constexpr H hash_impl( const char* current, uint32 remain, H value )
    6666                        {
    6767                                return remain == 0 ? value : hash_impl( current + 1, remain - 1, static_cast<H>( value ^ static_cast<H>( current[0] ) ) * hash_prime );
     
    156156
    157157        template < typename H >
    158         constexpr H hash_string( const char* s, size_t length )
     158        constexpr H hash_string( const char* s, uint32 length )
    159159        {
    160160                return detail::fnv_hash<H>::hash( s, length );
     
    257257        constexpr uint32 operator "" _h32( const char* str, size_t len )
    258258        {
    259                 return detail::fnv_hash< uint32 >::hash( str, len );
     259                return detail::fnv_hash< uint32 >::hash( str, static_cast< uint32 >( len ) );
    260260        }
    261261
    262262        constexpr uint64 operator "" _h64( const char* str, size_t len )
    263263        {
    264                 return detail::fnv_hash< uint64 >::hash( str, len );
     264                return detail::fnv_hash< uint64 >::hash( str, static_cast< uint32 >( len ) );
    265265        }
    266266
  • trunk/nv/stl/handle.hh

    r530 r533  
    4646
    4747                constexpr T index() const { return m_index; }
    48                 //size_t hash() const { return hash<T>()( T( m_counter << IBITS | m_index ) ); }
    49                 constexpr size_t hash() const { NV_ASSERT( false, "UNIMPLEMENTED!" ); return 0; }
     48                //uint32 hash() const { return hash<T>()( T( m_counter << IBITS | m_index ) ); }
     49                constexpr uint32 hash() const { NV_ASSERT( false, "UNIMPLEMENTED!" ); return 0; }
    5050        protected:
    5151                T m_index   : IBITS;
  • trunk/nv/stl/index_table.hh

    r530 r533  
    7676                index_type remove_swap( index_type dead_eindex )
    7777                {
    78                         if ( size_t( dead_eindex ) >= m_handles.size() ) return -1;
     78                        if ( uint32( dead_eindex ) >= m_handles.size() ) return -1;
    7979                        handle_type h = m_handles[dead_eindex];
    8080                        handle_type swap_handle = m_handles.back();
     
    9898                handle_type get_handle( index_type i ) const { return m_handles[unsigned( i )]; }
    9999
    100                 size_t size() const { return m_handles.size(); }
     100                uint32 size() const { return m_handles.size(); }
    101101
    102102        private:
     
    108108                                if ( size == 0 ) size = 1;
    109109                                while ( i >= size ) size = size * 2;
    110                                 m_indexes.resize( static_cast<size_t>( size ), -1 );
     110                                m_indexes.resize( static_cast<uint32>( size ), -1 );
    111111                        }
    112112                }
  • trunk/nv/stl/memory.hh

    r498 r533  
    1 // Copyright (C) 2015 ChaosForge Ltd
     1// Copyright (C) 2015-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    3636        public:
    3737                typedef T                                    value_type;
    38                 typedef size_t                               size_type;
     38                typedef uint32                               size_type;
    3939                typedef ptrdiff_t                            difference_type;
    4040                typedef value_type*                          pointer;
     
    5555                constexpr array_ref( value_type* a_data, size_type a_size )
    5656                        : m_data( a_data ), m_size( a_size ) {}
    57                 template< size_t N >
     57                template< uint32 N >
    5858                constexpr explicit array_ref( value_type( &a_data )[N] )
    5959                        : m_data( a_data ), m_size( N ) {}
     
    6565                }
    6666
    67                 constexpr size_t size() const { return m_size; }
     67                constexpr size_type size() const { return m_size; }
    6868                constexpr bool empty() const { return m_size != 0; }
    6969                constexpr const value_type* data() const { return m_data; }
     
    8585                constexpr const_reverse_iterator crbegin() const { return const_reverse_iterator( end() ); }
    8686                constexpr const_reverse_iterator crend() const { return const_reverse_iterator( begin() ); }
    87                 inline    const_iterator iat( size_t i ) const { NV_ASSERT_ALWAYS( i <= m_size, "Index out of range" ); return begin() + i; }
    88                 inline    iterator       iat( size_t i ) { NV_ASSERT_ALWAYS( i <= m_size, "Index out of range" ); return begin() + i; }
     87                inline    const_iterator iat( uint32 i ) const { NV_ASSERT_ALWAYS( i <= m_size, "Index out of range" ); return begin() + i; }
     88                inline    iterator       iat( uint32 i ) { NV_ASSERT_ALWAYS( i <= m_size, "Index out of range" ); return begin() + i; }
    8989
    9090                inline reference       front() { NV_ASSERT_ALWAYS( !empty(), "front() called on empty data!" );  return m_data[0]; }
     
    107107        public:
    108108                typedef T                                    value_type;
    109                 typedef size_t                               size_type;
     109                typedef uint32                               size_type;
    110110                typedef ptrdiff_t                            difference_type;
    111111                typedef const value_type*                    pointer;
     
    128128                constexpr array_view( const array_ref<T>& view )
    129129                        : m_data( view.data() ), m_size( view.size() ) {}
    130                 template< size_t N >
     130                template< uint32 N >
    131131                constexpr explicit array_view( const value_type( &a_data )[N] )
    132132                        : m_data( a_data ), m_size( N ) {}
     
    156156                inline const_reference back() const { NV_ASSERT_ALWAYS( !empty(), "front() called on empty data!" ); return m_data[m_size - 1]; }
    157157
    158                 inline const_iterator iat( size_t i ) const { NV_ASSERT_ALWAYS( i <= m_size, "Index out of range" ); return begin() + i; }
     158                inline const_iterator iat( uint32 i ) const { NV_ASSERT_ALWAYS( i <= m_size, "Index out of range" ); return begin() + i; }
    159159                const_reference operator[]( size_type i ) const { NV_ASSERT_ALWAYS( i < m_size, "Out of range" ); return m_data[i]; }
    160160
  • trunk/nv/stl/string.hh

    r487 r533  
    5959        inline string_view trimmed( const string_view& str )
    6060        {
    61                 size_t endpos = str.find_last_not_of( " \r\n\t" );
    62                 size_t startpos = str.find_first_not_of( " \r\n\t" );
     61                uint32 endpos = str.find_last_not_of( " \r\n\t" );
     62                uint32 startpos = str.find_first_not_of( " \r\n\t" );
    6363
    6464                if ( string_view::npos != endpos || string_view::npos != startpos )
     
    7373        inline string_view rtrimmed( const string_view& str )
    7474        {
    75                 size_t endpos = str.find_last_not_of( " \r\n\t" );
     75                uint32 endpos = str.find_last_not_of( " \r\n\t" );
    7676                if ( string_view::npos != endpos )
    7777                {
     
    8383        inline string_view ltrimmed( const string_view& str )
    8484        {
    85                 size_t startpos = str.find_first_not_of( " \r\n\t" );
     85                uint32 startpos = str.find_first_not_of( " \r\n\t" );
    8686                if ( string_view::npos != startpos )
    8787                {
     
    9494        inline string_view extract_extension( string_view filename )
    9595        {
    96                 size_t lastdot = filename.find_last_of( '.' );
     96                uint32 lastdot = filename.find_last_of( '.' );
    9797                if ( string_view::npos != lastdot )
    9898                        return filename.substr( lastdot + 1 );
     
    102102        inline string_view without_extension( string_view filename )
    103103        {
    104                 size_t lastdot = filename.find_last_of( '.' );
     104                uint32 lastdot = filename.find_last_of( '.' );
    105105                if ( string_view::npos != lastdot )
    106106                        return filename.substr( 0, lastdot );
     
    124124                template < typename S >
    125125                inline string_hash( const string_base<S>& rhs ) : inherited_type( hash_string< H >( rhs.data(), rhs.size() ) ) {}
    126                 constexpr string_hash( const char* str, size_t len ) : inherited_type( hash_string< H >( str, len ) ) {}
     126                constexpr string_hash( const char* str, uint32 len ) : inherited_type( hash_string< H >( str, len ) ) {}
    127127                constexpr string_hash( const char* str ) : inherited_type( hash_string< H >( str ) ) {}
    128128
    129129                // Literal constructors
    130130                template< size_t N >
    131                 constexpr string_hash( char( &s )[N] ) : inherited_type( hash_string< H >( s, N - 1 ) ) {}
     131                constexpr string_hash( char( &s )[N] ) : inherited_type( hash_string< H >( s, static_cast< uint32 >( N - 1 ) ) ) {}
    132132                template< size_t N >
    133                 constexpr string_hash( const char( &s )[N] ) : inherited_type( hash_string< H >( s, N - 1 ) ) {}
     133                constexpr string_hash( const char( &s )[N] ) : inherited_type( hash_string< H >( s, static_cast< uint32 >( N - 1 ) ) ) {}
    134134
    135135                constexpr explicit string_hash( hash_type value ) : inherited_type( value ) {}
     
    141141        constexpr shash32 operator "" _sh32( const char* str, size_t len )
    142142        {
    143                 return shash32( detail::fnv_hash< uint32 >::hash( str, len ) );
     143                return shash32( detail::fnv_hash< uint32 >::hash( str, static_cast< uint32 >( len ) ) );
    144144        }
    145145
    146146        constexpr shash64 operator "" _sh64( const char* str, size_t len )
    147147        {
    148                 return shash64( detail::fnv_hash< uint64 >::hash( str, len ) );
     148                return shash64( detail::fnv_hash< uint64 >::hash( str, static_cast< uint32 >( len ) ) );
    149149        }
    150150}
  • trunk/nv/stl/string/const_string.hh

    r438 r533  
    2525                inline explicit const_string( const char* str )
    2626                {
    27                         initialize( str, nvstrlen( str ) );
     27                        initialize( str, static_cast< uint32 >( nvstrlen( str ) ) );
    2828                }
    2929                inline const_string( const string_view& rhs )
     
    3434                inline const_string( char( &s )[N] )
    3535                {
    36                         initialize( s, N-1 );
     36                        initialize( s, static_cast< uint32 >( N-1 ) );
    3737                }
    3838                template< size_t N >
    3939                inline const_string( const char( &s )[N] )
    4040                {
    41                         initialize( s, N - 1 );
     41                        initialize( s, static_cast< uint32 >( N - 1 ) );
    4242                }
    4343                // TODO : implement
  • trunk/nv/stl/string/literal_string.hh

    r433 r533  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    1616        class literal_string : public string_base< array_view< char > >
    1717        {
    18                 constexpr literal_string( const char* str, size_t len ) : this_type( str, len ) {}
     18                constexpr literal_string( const char* str, uint32 len ) : this_type( str, len ) {}
    1919        public:
    2020                typedef string_base< array_view< char > > this_type;
     
    2222
    2323                template< size_t N >
    24                 constexpr literal_string( char( &s )[N] ) : this_type( s, N - 1 ) {}
     24                constexpr literal_string( char( &s )[N] ) : this_type( s, static_cast< uint32 >( N - 1 ) ) {}
    2525                template< size_t N >
    26                 constexpr literal_string( const char( &s )[N] ) : this_type( s, N - 1 ) {}
     26                constexpr literal_string( const char( &s )[N] ) : this_type( s, static_cast< uint32 >( N - 1 ) ) {}
    2727        };
    2828
    2929        constexpr literal_string operator "" _ls( const char* str, size_t len )
    3030        {
    31                 return literal_string( str, len );
     31                return literal_string( str, static_cast< uint32 >( len ) );
    3232        }
    3333
     
    4040        class hashed_literal_string : public string_base< array_view< char > >
    4141        {
    42                 constexpr hashed_literal_string( const char* str, size_t len, H hash_code )
     42                constexpr hashed_literal_string( const char* str, uint32 len, H hash_code )
    4343                        : this_type( str, len ), m_hash( hash_code ) {}
    4444        public:
     
    6767        constexpr hashed_literal_string_32 operator "" _hls32( const char* str, size_t len )
    6868        {
    69                 return hashed_literal_string_32( str, len, detail::fnv_hash< uint32 >::hash( str, len ) );
     69                return hashed_literal_string_32( str, static_cast< uint32 >( len ), detail::fnv_hash< uint32 >::hash( str, static_cast< uint32 >( len ) ) );
    7070        }
    7171
    7272        constexpr hashed_literal_string_64 operator "" _hls64( const char* str, size_t len )
    7373        {
    74                 return hashed_literal_string_64( str, len, detail::fnv_hash< uint64 >::hash( str, len ) );
     74                return hashed_literal_string_64( str, static_cast< uint32 >( len ), detail::fnv_hash< uint64 >::hash( str, static_cast< uint32 >( len ) ) );
    7575        }
    7676
  • trunk/nv/stl/string/string_base.hh

    r472 r533  
    1616{
    1717
    18         size_t sint32_to_buffer( array_ref< char > buffer, sint32 n );
    19         size_t sint64_to_buffer( array_ref< char > buffer, sint64 n );
    20         size_t uint32_to_buffer( array_ref< char > buffer, uint32 n );
    21         size_t uint64_to_buffer( array_ref< char > buffer, uint64 n );
    22         size_t f32_to_buffer( array_ref< char > buffer, f32 n );
    23         size_t f64_to_buffer( array_ref< char > buffer, f64 n );
     18        uint32 sint32_to_buffer( array_ref< char > buffer, sint32 n );
     19        uint32 sint64_to_buffer( array_ref< char > buffer, sint64 n );
     20        uint32 uint32_to_buffer( array_ref< char > buffer, uint32 n );
     21        uint32 uint64_to_buffer( array_ref< char > buffer, uint64 n );
     22        uint32 f32_to_buffer( array_ref< char > buffer, f32 n );
     23        uint32 f64_to_buffer( array_ref< char > buffer, f64 n );
    2424
    2525        sint32 buffer_to_sint32( const char* str, char** end );
     
    9090                size_type reverse_distance( ReverseIterator first, ReverseIterator last ) const
    9191                {
    92                         return this->size() - 1 - static_cast<size_t>( nv::distance( first, last ) );
     92                        return this->size() - 1 - static_cast<uint32>( nv::distance( first, last ) );
    9393                }
    9494        };
     
    124124                // Non-literal constructors
    125125                template< typename U >
    126                 inline string_view( U str, typename enable_if<is_same<U, const char*>::value>::type* = nullptr ) : this_type( str, str ? nvstrlen( str ) : 0 ) {}
     126                inline string_view( U str, typename enable_if<is_same<U, const char*>::value>::type* = nullptr ) : this_type( str, str ? static_cast< uint32 >( nvstrlen( str ) ) : 0 ) {}
    127127
    128128                // Non-literal constructors
    129129                template< typename U >
    130                 inline string_view( U str, typename enable_if<is_same<U, char*>::value>::type* = nullptr ) : this_type( str, nvstrlen( str ) ) {}
     130                inline string_view( U str, typename enable_if<is_same<U, char*>::value>::type* = nullptr ) : this_type( str, static_cast< uint32 >( nvstrlen( str ) ) ) {}
    131131
    132132                inline string_view& operator=( const string_view &rhs )
  • trunk/nv/stl/string/string_twine.hh

    r440 r533  
    7575                string_twine( const string_twine& s ) = default;
    7676
    77                 string_twine( const char* data, size_t sz )
     77                string_twine( const char* data, uint32 sz )
    7878                        : m_lhs( data, sz ), m_rhs()
    7979                {
     
    102102                }
    103103
    104                 size_t dump_size() const
     104                uint32 dump_size() const
    105105                {
    106106                        return dump_size( m_lhs ) + dump_size( m_rhs );
     
    114114                struct twine_cstring
    115115                {
    116                         size_t      size;
     116                        uint32      size;
    117117                        const char* data;
    118118                };
     
    141141                        twine_node( const string_twine* v ) : type( TWINE ) { value.twine = v; }
    142142                        twine_node( const string_view* v ) : type( STRING ) { value.string = v; }
    143                         twine_node( const char* d, size_t s ) : type( CSTRING ) { value.cstring.data = d; value.cstring.size = s; }
     143                        twine_node( const char* d, uint32 s ) : type( CSTRING ) { value.cstring.data = d; value.cstring.size = s; }
    144144                };
    145145
     
    168168                }
    169169
    170                 size_t dump_size( const twine_node& node ) const
     170                uint32 dump_size( const twine_node& node ) const
    171171                {
    172172                        switch ( node.type )
     
    201201                void dump_string( array_ref< char >& target, const string_view& string ) const
    202202                {
    203                         size_t dump_length = nv::min( target.size(), string.size() );
     203                        uint32 dump_length = nv::min( target.size(), string.size() );
    204204                        if ( dump_length > 0 )
    205205                        {
     
    219219        inline string_twine operator+( const char (&lhs)[N], const string_twine& rhs )
    220220        {
    221                 return string_twine( lhs, N-1 ).concat( rhs );
     221                return string_twine( lhs, static_cast< uint32 >( N-1 ) ).concat( rhs );
    222222        }
    223223
     
    225225        inline string_twine operator+( const string_twine& lhs, const char( &rhs )[N] )
    226226        {
    227                 return lhs.concat( string_twine( rhs, N - 1 ) );
     227                return lhs.concat( string_twine( rhs, static_cast< uint32 >( N - 1 ) ) );
    228228        }
    229229
  • trunk/nv/stl/vector.hh

    r434 r533  
    1 // Copyright (C) 2014-2015 ChaosForge Ltd
     1// Copyright (C) 2014-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    2525        using growable_dynamic_storage = growing_storage< dynamic_storage< T > >;
    2626
    27         template< typename T, size_t N >
     27        template< typename T, uint32 N >
    2828        using growable_static_storage = growing_storage< static_storage< T, N > >;
    2929
  • trunk/nv_bullet.lua

    r520 r533  
    2727        links { "nv-core", "nv-gl", "nv-formats", "nv-lua", "nv-lib", "nv-io", "nv-gfx" }
    2828
     29        includedirs { "D:/Libraries/bullet2/src/" }
     30
    2931        configuration "debug"
    30                 nv_bullet_configure( "D:/Libraries/bullet2/", "Debug", "_debug" )
     32                nv_bullet_configure( "D:/Libraries/bullet2/x86/", "RelWithDebInfo", "_rdbg" )
     33--              nv_bullet_configure( "D:/Libraries/bullet2/x86/", "Debug", "_debug" )
    3134
    32         configuration "not debug"
    33                 nv_bullet_configure( "D:/Libraries/bullet2/", "Release" )
     35        configuration "profiler"
     36                nv_bullet_configure( "D:/Libraries/bullet2/x86/", "Release" )
     37
     38        configuration "release"
     39                nv_bullet_configure( "D:/Libraries/bullet2/x86/", "Release" )
     40
     41        configuration "debug_64"
     42                nv_bullet_configure( "D:/Libraries/bullet2/x86_64/", "RelWithDebInfo", "_rdbg" )
     43--              nv_bullet_configure( "D:/Libraries/bullet2/x86_64/", "Debug", "_debug" )
     44
     45        configuration "profiler_64"
     46                nv_bullet_configure( "D:/Libraries/bullet2/x86_64/", "Release" )
     47
     48        configuration "release_64"
     49                nv_bullet_configure( "D:/Libraries/bullet2/x86_64/", "Release" )
    3450
    3551
     52
  • trunk/src/core/logger.cc

    r402 r533  
    144144{
    145145        char stamp[16];
    146         size_t ssize = timestamp( stamp );
     146        uint32 ssize = timestamp( stamp );
    147147
    148148#if NV_COMPILER == NV_MSVC
     
    180180{
    181181        char stamp[16];
    182         size_t ssize = timestamp( stamp );
     182        uint32 ssize = timestamp( stamp );
    183183#if 0 // NV_PLATFORM == NV_WINDOWS
    184184        // Turns out WriteFile on Windows is unbuffered and quite slower than fwrite
     
    242242}
    243243
    244 nv::size_t nv::log_sink::timestamp( char* buffer ) const
     244nv::uint32 nv::log_sink::timestamp( char* buffer ) const
    245245{
    246246        uint32 ms = get_system_ms();
  • trunk/src/core/profiler.cc

    r409 r533  
    109109        char buffer[128];
    110110        snprintf( buffer, 128, "%-23s %6s %6s %9s %6s", "TAG", "%PARNT", "CALLS", "TOTAL(ms)", "AVG(ms)" );
    111         NV_LOG_INFO( string_view( buffer, nvstrlen( buffer ) ) );
     111        NV_LOG_INFO( string_view( buffer, static_cast< uint32 >( nvstrlen( buffer ) ) ) );
    112112        log_node_children( 0, m_root );
    113113        NV_LOG_INFO( "-- PROFILER REPORT END ---------------------------------" );
     
    131131                        snprintf( buffer + indent, 128 - indent, "%*.*s %6.2f %6d %9.2f %6.2f", indent - 23, 23 - indent,
    132132                                c->m_tag.data(), pparent, calls, total_ms, avg_ms );
    133                         NV_LOG_INFO( string_view( buffer, nvstrlen( buffer ) ) );
     133                        NV_LOG_INFO( string_view( buffer, static_cast< uint32 >( nvstrlen( buffer ) ) ) );
    134134                        if ( c->m_children.size() > 0 )
    135135                        {
  • trunk/src/core/random.cc

    r509 r533  
    1616static const uint32 mt_matrix_a   = 0x9908B0DFUL;
    1717
    18 #define NV_MT_MIXBITS(u, v) ( ( (u) & mt_upper_mask) | ( (v) & mt_lower_mask) )
    19 #define NV_MT_TWIST(u, v)  ( (NV_MT_MIXBITS(u, v) >> 1) ^ ( (v) & 1UL ? mt_matrix_a : 0UL) )
     18#define NV_MT_MIXBITS(u, v) ( uint32( (u) & mt_upper_mask) | uint32( (v) & mt_lower_mask) )
     19#define NV_MT_TWIST(u, v)  ( uint32(NV_MT_MIXBITS(u, v) >> uint32(1)) ^ uint32( (v) & uint32(1) ? mt_matrix_a : uint32(0)) )
    2020
    2121nv::random& random::get()
     
    4343{
    4444        uint32 *p = m_state;
    45 
    46         for ( int count = ( mersenne_n - mersenne_m + 1 ); --count; p++ )
     45        constexpr int m = mersenne_m;
     46        constexpr int n = mersenne_n;
     47
     48        for ( int count = ( n - m + 1 ); --count; p++ )
    4749                *p = p[mersenne_m] ^ NV_MT_TWIST( p[0], p[1] );
    4850
    4951        for ( int count = mersenne_m; --count; p++ )
    50                 *p = p[mersenne_m - mersenne_n] ^ NV_MT_TWIST( p[0], p[1] );
    51 
    52         *p = p[mersenne_m - mersenne_n] ^ NV_MT_TWIST( p[0], m_state[0] );
     52        {
     53                *p = p[m - n] ^ NV_MT_TWIST( p[0], p[1] );
     54        }
     55
     56        *p = p[m - n] ^ NV_MT_TWIST( p[0], m_state[0] );
    5357
    5458        m_remaining = mersenne_n;
  • trunk/src/gfx/texture_atlas.cc

    r471 r533  
    1111using namespace nv;
    1212
    13 texture_atlas::texture_atlas( ivec2 size, nv::size_t depth, nv::size_t border /*= 1*/ )
     13texture_atlas::texture_atlas( ivec2 size, uint32 depth, uint32 border /*= 1*/ )
    1414        : image( size, depth ), m_used( 0 ), m_border( border )
    1515{
     
    2626        int best_width  = nv::limits::si_max;
    2727
    28         for( size_t i=0; i < m_nodes.size(); ++i )
     28        for( uint32 i=0; i < m_nodes.size(); ++i )
    2929        {
    3030                int y = fit( i, size );
     
    5151        m_nodes.insert( m_nodes.begin() + best_index, ivec3( r.pos.x, r.pos.y + size.y, size.x ) );
    5252
    53         for( size_t i = static_cast<size_t>( best_index )+1; i < m_nodes.size(); ++i )
     53        for( uint32 i = static_cast<uint32>( best_index )+1; i < m_nodes.size(); ++i )
    5454        {
    5555                ivec3 node = m_nodes[ i ];
     
    8282}
    8383
    84 int texture_atlas::fit( nv::size_t index, ivec2 size )
     84int texture_atlas::fit( uint32 index, ivec2 size )
    8585{
    8686        ivec3 node = m_nodes[ index ];
     
    113113void texture_atlas::merge()
    114114{
    115         for ( size_t i=0; i < m_nodes.size()-1; ++i )
     115        for ( uint32 i=0; i < m_nodes.size()-1; ++i )
    116116    {
    117117                if ( m_nodes[ i ].y == m_nodes[ i+1 ].y )
  • trunk/src/gl/gl_device.cc

    r506 r533  
    452452                glGetActiveUniform( p->glid, i, 128, &uni_nlen, &uni_len, &uni_type, name_buffer );
    453453
    454                 string_view name( name_buffer, size_t( uni_nlen ) );
     454                string_view name( name_buffer, uint32( uni_nlen ) );
    455455
    456456                // skip built-ins
     
    461461
    462462                // check for array
    463                 size_t arrchar = name.find( '[' );
     463                uint32 arrchar = name.find( '[' );
    464464                if ( arrchar != string_view::npos )
    465465                {
  • trunk/src/image/miniz.cc

    r520 r533  
    33
    44using namespace nv;
    5 
    6 #define MINIZ_NO_TIME
    7 #define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
    8 
    9 #define MINIZ_HAS_64BIT_REGISTERS 0
    10 #define TINFL_USE_64BIT_BITBUF 0
    115
    126#if NV_COMPILER == NV_CLANG
     
    1711
    1812#if defined( _M_IX86 ) || defined( _M_X64 ) || defined( __i386__ ) || defined( __i386 ) || defined( __i486__ ) || defined( __i486 ) || defined( i386 ) || defined( __ia64__ ) || defined( __x86_64__ )
    19 // MINIZ_X86_OR_X64_CPU is only used to help set the below macros.
    20 #define MINIZ_X86_OR_X64_CPU 1
    21 #endif
    22 
    23 #if (__BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU
    24 // Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian.
    25 #define MINIZ_LITTLE_ENDIAN 1
    26 #endif
    27 
    28 #if MINIZ_X86_OR_X64_CPU
    2913// Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses.
    3014#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
    31 #endif
    32 
    33 #if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__)
    34 // Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are reasonably fast (and don't involve compiler generated calls to helper functions).
    35 #define MINIZ_HAS_64BIT_REGISTERS 1
    3615#endif
    3716
     
    204183        const char *mz_error( int err );
    205184
    206         // Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used as a drop-in replacement for the subset of zlib that miniz.c supports.
    207         // Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project.
    208 #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
    209         typedef unsigned char Byte;
    210         typedef unsigned int uInt;
    211         typedef mz_ulong uLong;
    212         typedef Byte Bytef;
    213         typedef uInt uIntf;
    214         typedef char charf;
    215         typedef int intf;
    216         typedef void *voidpf;
    217         typedef uLong uLongf;
    218         typedef void *voidp;
    219         typedef void *const voidpc;
    220 #define Z_NULL                0
    221 #define Z_NO_FLUSH            MZ_NO_FLUSH
    222 #define Z_PARTIAL_FLUSH       MZ_PARTIAL_FLUSH
    223 #define Z_SYNC_FLUSH          MZ_SYNC_FLUSH
    224 #define Z_FULL_FLUSH          MZ_FULL_FLUSH
    225 #define Z_FINISH              MZ_FINISH
    226 #define Z_BLOCK               MZ_BLOCK
    227 #define Z_OK                  MZ_OK
    228 #define Z_STREAM_END          MZ_STREAM_END
    229 #define Z_NEED_DICT           MZ_NEED_DICT
    230 #define Z_ERRNO               MZ_ERRNO
    231 #define Z_STREAM_ERROR        MZ_STREAM_ERROR
    232 #define Z_DATA_ERROR          MZ_DATA_ERROR
    233 #define Z_MEM_ERROR           MZ_MEM_ERROR
    234 #define Z_BUF_ERROR           MZ_BUF_ERROR
    235 #define Z_VERSION_ERROR       MZ_VERSION_ERROR
    236 #define Z_PARAM_ERROR         MZ_PARAM_ERROR
    237 #define Z_NO_COMPRESSION      MZ_NO_COMPRESSION
    238 #define Z_BEST_SPEED          MZ_BEST_SPEED
    239 #define Z_BEST_COMPRESSION    MZ_BEST_COMPRESSION
    240 #define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION
    241 #define Z_DEFAULT_STRATEGY    MZ_DEFAULT_STRATEGY
    242 #define Z_FILTERED            MZ_FILTERED
    243 #define Z_HUFFMAN_ONLY        MZ_HUFFMAN_ONLY
    244 #define Z_RLE                 MZ_RLE
    245 #define Z_FIXED               MZ_FIXED
    246 #define Z_DEFLATED            MZ_DEFLATED
    247 #define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
    248 #define alloc_func            mz_alloc_func
    249 #define free_func             mz_free_func
    250 #define internal_state        mz_internal_state
    251 #define z_stream              mz_stream
    252 #define deflateInit           mz_deflateInit
    253 #define deflateInit2          mz_deflateInit2
    254 #define deflateReset          mz_deflateReset
    255 #define deflate               mz_deflate
    256 #define deflateEnd            mz_deflateEnd
    257 #define deflateBound          mz_deflateBound
    258 #define compress              mz_compress
    259 #define compress2             mz_compress2
    260 #define compressBound         mz_compressBound
    261 #define inflateInit           mz_inflateInit
    262 #define inflateInit2          mz_inflateInit2
    263 #define inflate               mz_inflate
    264 #define inflateEnd            mz_inflateEnd
    265 #define uncompress            mz_uncompress
    266 #define crc32                 mz_crc32
    267 #define adler32               mz_adler32
    268 #define MAX_WBITS             15
    269 #define MAX_MEM_LEVEL         9
    270 #define zError                mz_error
    271 #define ZLIB_VERSION          MZ_VERSION
    272 #define ZLIB_VERNUM           MZ_VERNUM
    273 #define ZLIB_VER_MAJOR        MZ_VER_MAJOR
    274 #define ZLIB_VER_MINOR        MZ_VER_MINOR
    275 #define ZLIB_VER_REVISION     MZ_VER_REVISION
    276 #define ZLIB_VER_SUBREVISION  MZ_VER_SUBREVISION
    277 #define zlibVersion           mz_version
    278 #define zlib_version          mz_version()
    279 #endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
    280185
    281186#endif // MINIZ_NO_ZLIB_APIS
     
    321226                mz_uint16 m_bit_flag;
    322227                mz_uint16 m_method;
    323 #ifndef MINIZ_NO_TIME
    324                 time_t m_time;
    325 #endif
     228//              time_t m_time;
     229
    326230                mz_uint32 m_crc32;
    327231                mz_uint64 m_comp_size;
     
    567471        } tinfl_huff_table;
    568472
    569 #if MINIZ_HAS_64BIT_REGISTERS
    570 #define TINFL_USE_64BIT_BITBUF 1
    571 #endif
    572 
    573 #if TINFL_USE_64BIT_BITBUF
     473#if NV_ARCHITECTURE == NV_64BIT
    574474        typedef mz_uint64 tinfl_bit_buf_t;
    575475#define TINFL_BITBUF_SIZE (64)
     
    766666#define MZ_CLEAR_OBJ(obj) nvmemset(&(obj), 0, sizeof(obj))
    767667
    768 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
     668#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN
    769669#define MZ_READ_LE16(p) *((const mz_uint16 *)(p))
    770670#define MZ_READ_LE32(p) *((const mz_uint32 *)(p))
     
    13821282                                                {
    13831283                                                        int sym2; mz_uint code_len;
    1384 #if TINFL_USE_64BIT_BITBUF
     1284#if NV_ARCHITECTURE == NV_64BIT
    13851285                                                        if ( num_bits < 30 ) { bit_buf |= ( ( (tinfl_bit_buf_t)MZ_READ_LE32( pIn_buf_cur ) ) << num_bits ); pIn_buf_cur += 4; num_bits += 32; }
    13861286#else
     
    13971297                                                                break;
    13981298
    1399 #if !TINFL_USE_64BIT_BITBUF
     1299#if NV_ARCHITECTURE == NV_32BIT
    14001300                                                        if ( num_bits < 15 ) { bit_buf |= ( ( (tinfl_bit_buf_t)MZ_READ_LE16( pIn_buf_cur ) ) << num_bits ); pIn_buf_cur += 2; num_bits += 16; }
    14011301#endif
     
    18351735        static const mz_uint mz_bitmasks[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
    18361736
    1837 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS
     1737#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN && NV_ARCHITECTURE == NV_64BIT
     1738
    18381739        static mz_bool tdefl_compress_lz_codes( tdefl_compressor *d )
    18391740        {
     
    19681869                return ( d->m_pOutput_buf < d->m_pOutput_buf_end );
    19691870        }
    1970 #endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS
     1871#endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN && NV_ARCHITECTURE == NV_64BIT
     1872
    19711873
    19721874        static mz_bool tdefl_compress_block( tdefl_compressor *d, mz_bool static_block )
     
    21452047#endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES
    21462048
    2147 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
     2049#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN
    21482050        static mz_bool tdefl_compress_fast( tdefl_compressor *d )
    21492051        {
     
    24802382                        return ( d->m_prev_return_status = tdefl_flush_output_buffer( d ) );
    24812383
    2482 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
     2384#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN
    24832385                if ( ( ( d->m_flags & TDEFL_MAX_PROBES_MASK ) == 1 ) &&
    24842386                        ( ( d->m_flags & TDEFL_GREEDY_PARSING_FLAG ) != 0 ) &&
     
    24892391                }
    24902392                else
    2491 #endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
     2393#endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN
    24922394                {
    24932395                        if ( !tdefl_compress_normal( d ) )
  • trunk/src/io/c_file_system.cc

    r438 r533  
    4848        stream* fstream = open( path, "rb" );
    4949        if ( !fstream ) return const_string();
    50         uint32 size = fstream->size();
     50        uint32 size = static_cast< uint32 >( fstream->size() );
    5151        const_string result( nullptr, size );
    5252        fstream->read( const_cast<char*>( result.data() ), size, 1 );
  • trunk/src/lua/lua_state.cc

    r515 r533  
    172172}
    173173
    174 nv::size_t lua::table_guard::get_size()
     174nv::uint32 lua::table_guard::get_size()
    175175{
    176176        return nlua_rawlen( m_state, -1 );
     
    194194        {
    195195                str = lua_tolstring( m_state, -1, &l );
    196                 result = hash_string< uint64 >( str, l );
     196                result = hash_string< uint64 >( str, static_cast< uint32 >( l ) );
    197197                //NV_LOG_DEBUG( str );
    198198        }
     
    210210        {
    211211                str = lua_tolstring( m_state, -1, &l );
    212                 string_view sv( str, l );
     212                string_view sv( str, static_cast< uint32 >( l ) );
    213213                result = table ? table->insert( sv ) : shash64( sv );
    214214        }
     
    226226        {
    227227                str = lua_tolstring( m_state, -1, &l );
    228                 result = hash_string< uint64 >( str, l );
     228                result = hash_string< uint64 >( str, static_cast< uint32 >( l ) );
    229229                //NV_LOG_DEBUG( str );
    230230        }
     
    247247                str = defval.data();
    248248        }
    249         string128 result( str, l );
     249        string128 result( str, static_cast< uint32 >( l ) );
    250250        lua_pop( m_state, 1 );
    251251        return result;
     
    266266                str = defval.data();
    267267        }
    268         const_string result( str, l );
     268        const_string result( str, static_cast< uint32 >( l ) );
    269269        lua_pop( m_state, 1 );
    270270        return result;
     
    280280        {
    281281                str = lua_tolstring( m_state, -1, &l );
    282                 string_view sv( str, l );
     282                string_view sv( str, static_cast< uint32 >( l ) );
    283283                result = table ? table->insert( sv ) : shash64( sv );
    284284        }
     
    301301                str = defval.data();
    302302        }
    303         const_string result( str, l );
     303        const_string result( str, static_cast< uint32 >( l ) );
    304304        lua_pop( m_state, 1 );
    305305        return result;
     
    320320                str = defval.data();
    321321        }
    322         string128 result( str, l );
     322        string128 result( str, static_cast< uint32 >( l ) );
    323323        lua_pop( m_state, 1 );
    324324        return result;
     
    339339                str = defval.data();
    340340        }
    341         string64 result( str, l );
     341        string64 result( str, static_cast< uint32 >( l ) );
    342342        lua_pop( m_state, 1 );
    343343        return result;
     
    359359                str = defval.data();
    360360        }
    361         string32 result( str, l );
     361        string32 result( str, static_cast< uint32 >( l ) );
    362362        lua_pop( m_state, 1 );
    363363        return result;
  • trunk/src/lua/lua_values.cc

    r490 r533  
    105105        size_t length = 0;
    106106        const char* result = lua_tolstring( L, index, &length );
    107         return string_view( result, length );
     107        return string_view( result, static_cast< uint32 >( length ) );
    108108}
    109109
  • trunk/src/stl/string.cc

    r442 r533  
    2727}
    2828
    29 nv::size_t nv::sint32_to_buffer( array_ref< char > buffer, sint32 n )
     29nv::uint32 nv::sint32_to_buffer( array_ref< char > buffer, sint32 n )
    3030{
    3131        if ( buffer.size() < 2 ) return 0;
     
    4646        *s = '\0';
    4747        string_reverse( buffer.begin(), s - 1 );
    48         return static_cast<nv::size_t>( s - buffer.begin() );
    49 }
    50 
    51 nv::size_t nv::sint64_to_buffer( array_ref< char > buffer, sint64 n )
     48        return static_cast<nv::uint32>( s - buffer.begin() );
     49}
     50
     51nv::uint32 nv::sint64_to_buffer( array_ref< char > buffer, sint64 n )
    5252{
    5353        if ( buffer.size() < 2 ) return 0;
     
    6868        *s = '\0';
    6969        string_reverse( buffer.begin(), s - 1 );
    70         return static_cast<nv::size_t>( s - buffer.begin() );
    71 }
    72 
    73 nv::size_t nv::uint32_to_buffer( array_ref< char > buffer, uint32 n )
     70        return static_cast<nv::uint32>( s - buffer.begin() );
     71}
     72
     73nv::uint32 nv::uint32_to_buffer( array_ref< char > buffer, uint32 n )
    7474{
    7575        if ( buffer.size() < 2 ) return 0;
     
    8484        *s = '\0';
    8585        string_reverse( buffer.begin(), s - 1 );
    86         return static_cast<nv::size_t>( s - buffer.begin() );
    87 }
    88 
    89 nv::size_t nv::uint64_to_buffer( array_ref< char > buffer, uint64 n )
     86        return static_cast<nv::uint32>( s - buffer.begin() );
     87}
     88
     89nv::uint32 nv::uint64_to_buffer( array_ref< char > buffer, uint64 n )
    9090{
    9191        if ( buffer.size() < 2 ) return 0;
     
    100100        *s = '\0';
    101101        string_reverse( buffer.begin(), s - 1 );
    102         return static_cast<nv::size_t>( s - buffer.begin() );
    103 }
    104 
    105 nv::size_t nv::f32_to_buffer( array_ref< char > buffer, f32 n )
     102        return static_cast<nv::uint32>( s - buffer.begin() );
     103}
     104
     105nv::uint32 nv::f32_to_buffer( array_ref< char > buffer, f32 n )
    106106{
    107107#if NV_COMPILER == NV_MSVC
     
    110110        int result = snprintf( buffer.data(), buffer.size(), "%.*g", 6, n );
    111111#endif
    112         return static_cast<nv::size_t>( result > 0 ? result : 0 );
    113 }
    114 
    115 nv::size_t nv::f64_to_buffer( array_ref< char > buffer, f64 n )
     112        return static_cast<nv::uint32>( result > 0 ? result : 0 );
     113}
     114
     115nv::uint32 nv::f64_to_buffer( array_ref< char > buffer, f64 n )
    116116{
    117117#if NV_COMPILER == NV_MSVC
     
    120120        int result = snprintf( buffer.data(), buffer.size(), "%.*g", 6, n );
    121121#endif
    122         return static_cast<nv::size_t>( result > 0 ? result : 0 );
     122        return static_cast<nv::uint32>( result > 0 ? result : 0 );
    123123}
    124124
Note: See TracChangeset for help on using the changeset viewer.