- Timestamp:
- 01/12/17 13:16:48 (8 years ago)
- Location:
- trunk
- Files:
-
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/base/capi.hh
r471 r533 1 // Copyright (C) 2015 ChaosForge Ltd1 // Copyright (C) 2015-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/base/common.hh
r505 r533 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 162 162 #endif 163 163 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]))))) 165 165 #define NV_SAFE_ARRAY( arr, idx, def ) ( index < NV_COUNT_OF(arr) ? (arr)[idx] : (def) ) 166 166 … … 292 292 }; 293 293 294 using log_handler_t = void( *)( int, const char*, size_t);294 using log_handler_t = void( *)( int, const char*, uint32 ); 295 295 296 296 log_handler_t get_log_handler(); … … 298 298 299 299 template < typename T > 300 constexpr size_tsize( const T& t )300 constexpr uint32 size( const T& t ) 301 301 { 302 302 return t.size(); 303 303 } 304 304 305 template < typename T, size_tN >306 constexpr size_tsize( const T (&)[N] )305 template < typename T, uint32 N > 306 constexpr uint32 size( const T (&)[N] ) 307 307 { 308 308 return N; … … 315 315 } 316 316 317 template < typename T, size_tN >317 template < typename T, uint32 N > 318 318 constexpr bool empty( const T(&)[N] ) 319 319 { … … 333 333 } 334 334 335 template < typename T, size_tN >335 template < typename T, uint32 N > 336 336 constexpr T* data( T(&array)[N] ) 337 337 { -
trunk/nv/common.hh
r401 r533 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/core/logger.hh
r399 r533 43 43 * Optional timestamp string 44 44 */ 45 size_ttimestamp( char* buffer ) const;45 uint32 timestamp( char* buffer ) const; 46 46 /** 47 47 * Log level name (unpadded) -
trunk/nv/core/logging.hh
r435 r533 40 40 void log_append( string_view ref ) 41 41 { 42 size_t count = ::nv::min< size_t>( ref.size(), space_left()-1 );42 uint32 count = ::nv::min< uint32 >( ref.size(), space_left()-1 ); 43 43 nvmemcpy( m_pos, ref.data(), count ); 44 44 m_pos += count; … … 72 72 { 73 73 *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 ) ) ); 75 75 m_pos = m_message; 76 76 } … … 83 83 virtual ~logger_base() {} 84 84 protected: 85 inline size_tspace_left() const85 inline uint32 space_left() const 86 86 { 87 return 1024 - static_cast< size_t>( m_pos - m_message );87 return 1024 - static_cast< uint32 >( m_pos - m_message ); 88 88 } 89 89 -
trunk/nv/core/types.hh
r519 r533 1 // Copyright (C) 2014 Kornel Kisielewicz1 // Copyright (C) 2014-2017 Kornel Kisielewicz 2 2 // http://chaosforge.org/ 3 3 // … … 96 96 constructor_t constructor; //!< Pointers to the constructor 97 97 destructor_t destructor; //!< Pointers to the destructor 98 size_tsize; //!< Result of sizeof(type) operation98 uint32 size; //!< Result of sizeof(type) operation 99 99 type_entry* base_type; //!< Base type 100 100 vector<type_field> field_list; //!< Field list -
trunk/nv/engine/light.hh
r529 r533 85 85 uint32 count = nv::min< uint32 >( lights.size(), m_max_size ); 86 86 uint32 shadow_counter[4] = { 0, 0, 0, 0 }; 87 for ( size_ti = 0; i < count; ++i )87 for ( uint32 i = 0; i < count; ++i ) 88 88 { 89 89 m_cameras[i].set_lookat( vec3(), vec3( lights[i]->direction ), vec3( 1.0f, 0.0f, 0.0f ) ); … … 149 149 { 150 150 uint32 count = nv::min< uint32 >( lights.size(), m_max_size ); 151 for ( size_ti = 0; i < count; ++i )151 for ( uint32 i = 0; i < count; ++i ) 152 152 { 153 153 vec3 nlp = lights[i]->position; -
trunk/nv/gfx/texture_atlas.hh
r437 r533 21 21 { 22 22 public: 23 texture_atlas( ivec2 size, size_t depth, size_tborder = 1 );23 texture_atlas( ivec2 size, uint32 depth, uint32 border = 1 ); 24 24 region get_region( ivec2 size ); 25 25 void clear(); 26 size_tget_used() const { return m_used; }26 uint32 get_used() const { return m_used; } 27 27 protected: 28 int fit( size_tindex, ivec2 size );28 int fit( uint32 index, ivec2 size ); 29 29 void merge(); 30 30 private: 31 size_tm_used;32 size_tm_border;31 uint32 m_used; 32 uint32 m_border; 33 33 vector<ivec3> m_nodes; 34 34 }; -
trunk/nv/interface/mesh_data.hh
r487 r533 25 25 class child_list : noncopyable 26 26 { 27 static constexpr size_tMAX_CHILDREN = 7;27 static constexpr uint32 MAX_CHILDREN = 7; 28 28 public: 29 29 child_list() : m_size( 0 ) … … 74 74 } 75 75 76 size_tsize() const { return m_data.size(); }76 uint32 size() const { return m_data.size(); } 77 77 bool empty() const { return m_data.empty(); } 78 78 79 const data_node_info& operator[]( size_ti ) const79 const data_node_info& operator[]( uint32 i ) const 80 80 { 81 81 return m_data[i]; … … 85 85 { 86 86 if ( size() != other.size() ) return false; 87 for ( size_ti = 0; i < size(); ++i )87 for ( uint32 i = 0; i < size(); ++i ) 88 88 if ( m_data[i].name != other.m_data[i].name ) return false; 89 89 return true; … … 92 92 sint16 resolve( shash64 name ) const 93 93 { 94 for ( size_ti = 0; i < size(); ++i )94 for ( uint32 i = 0; i < size(); ++i ) 95 95 if ( m_data[i].name == name ) 96 96 return sint16(i); … … 128 128 } 129 129 130 const child_list& children( size_ti ) const130 const child_list& children( uint32 i ) const 131 131 { 132 132 return m_children[i]; … … 166 166 } 167 167 168 const child_list& children( size_ti ) const168 const child_list& children( uint32 i ) const 169 169 { 170 170 return m_info.children(i); 171 171 } 172 172 173 size_tsize() const { return m_data.size(); }173 uint32 size() const { return m_data.size(); } 174 174 bool empty() const { return m_data.empty(); } 175 175 176 bool is_animated( size_ti ) const176 bool is_animated( uint32 i ) const 177 177 { 178 178 if ( i >= m_data.size() ) return false; … … 209 209 } 210 210 211 const data_channel_set* operator[]( size_ti ) const211 const data_channel_set* operator[]( uint32 i ) const 212 212 { 213 213 return m_data[i]; 214 214 } 215 const data_node_info& get_info( size_ti ) const215 const data_node_info& get_info( uint32 i ) const 216 216 { 217 217 return m_info[i]; -
trunk/nv/lib/curses.hh
r395 r533 1 // Copyright (C) 2014-201 5ChaosForge Ltd1 // Copyright (C) 2014-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 14 14 15 15 #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 17 21 #elif NV_PLATFORM == NV_APPLE 18 22 # define NV_CURSES_PATH "" -
trunk/nv/lib/fmod.hh
r395 r533 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 14 14 15 15 #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 17 21 #elif NV_PLATFORM == NV_APPLE 18 22 # define NV_FMOD_PATH "fmodex.framework/fmodex" -
trunk/nv/lib/freetype2.hh
r406 r533 18 18 19 19 #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 21 25 #elif NV_PLATFORM == NV_APPLE 22 26 # define NV_FREETYPE_PATH "freetype.framework/freetype" -
trunk/nv/lib/gl.hh
r492 r533 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/lib/lua.hh
r490 r533 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 46 46 47 47 #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 51 57 #elif NV_PLATFORM == NV_APPLE 52 58 # define NV_LUA_PATH_51 "lua5.1.dylib" -
trunk/nv/lib/sdl.hh
r395 r533 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 14 14 15 15 #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 17 21 #elif NV_PLATFORM == NV_APPLE 18 22 # define NV_SDL_PATH "SDL2.framework/SDL" -
trunk/nv/lib/sdl_image.hh
r395 r533 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 12 12 13 13 #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 15 19 #elif NV_PLATFORM == NV_APPLE 16 20 # define NV_SDL_IMAGE_PATH "SDL2_image.framework/SDL_image" -
trunk/nv/lib/sdl_mixer.hh
r395 r533 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 12 12 13 13 #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 15 19 #elif NV_PLATFORM == NV_APPLE 16 20 # define NV_SDL_MIXER_PATH "SDL2_mixer.framework/SDL_mixer" -
trunk/nv/lua/lua_raw.hh
r494 r533 37 37 size_t len; 38 38 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 ) ); 40 40 } 41 41 -
trunk/nv/lua/lua_state.hh
r515 r533 369 369 table_guard( const table_guard& parent, const path& p ); 370 370 virtual ~table_guard(); 371 size_tget_size();371 uint32 get_size(); 372 372 373 373 bool has_field( string_view element ); -
trunk/nv/stl/algorithm/heap.hh
r472 r533 25 25 template< 26 26 typename RandomAccessIterator, 27 typename DifferenceType,28 27 typename T, 29 28 typename Predicate … … 31 30 inline void push_heap_impl( 32 31 RandomAccessIterator first, 33 DifferenceTypepivot,34 DifferenceTypetop,32 ptrdiff_t pivot, 33 ptrdiff_t top, 35 34 T&& value, 36 35 Predicate pred … … 38 37 { 39 38 for ( 40 DifferenceTypeindex = ( pivot - 1 ) / 2;39 ptrdiff_t index = ( pivot - 1 ) / 2; 41 40 top < pivot && pred( *( first + index ), value ); 42 41 index = ( pivot - 1 ) / 2 ) … … 51 50 template< 52 51 typename RandomAccessIterator, 53 typename DifferenceType,54 52 typename T, 55 53 typename Predicate … … 57 55 inline void fix_heap( 58 56 RandomAccessIterator first, 59 DifferenceTypepivot,60 DifferenceTypebottom,57 ptrdiff_t pivot, 58 ptrdiff_t bottom, 61 59 T&& value, 62 60 Predicate pred 63 61 ) 64 62 { 65 DifferenceTypetop = pivot;66 DifferenceTypeindex = 2 * pivot + 2;63 ptrdiff_t top = pivot; 64 ptrdiff_t index = 2 * pivot + 2; 67 65 for ( ; index < bottom; index = 2 * index + 2 ) 68 66 { -
trunk/nv/stl/container/contiguous_storage.hh
r438 r533 1 // Copyright (C) 2015 ChaosForge Ltd1 // Copyright (C) 2015-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 21 21 { 22 22 23 template< typename T, size_tN >23 template< typename T, uint32 N > 24 24 class static_storage 25 25 { … … 36 36 37 37 protected: 38 static constexpr bool reallocate( size_tnew_size, bool /*copy_needed*/ ) { return new_size <= N; }38 static constexpr bool reallocate( uint32 new_size, bool /*copy_needed*/ ) { return new_size <= N; } 39 39 40 40 static_storage() = default; … … 89 89 ~dynamic_storage() = default; 90 90 91 bool reallocate( size_tnew_size, bool copy_needed )91 bool reallocate( uint32 new_size, bool copy_needed ) 92 92 { 93 93 if ( copy_needed ) -
trunk/nv/stl/container/growing_storage.hh
r487 r533 1 // Copyright (C) 2015 ChaosForge Ltd1 // Copyright (C) 2015-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 35 35 namespace detail 36 36 { 37 template < typename SizeType, size_tCapacity >37 template < typename SizeType, uint32 Capacity > 38 38 struct growing_storage_size 39 39 { 40 static constexpr size_tmax_size() { return Capacity; }41 static constexpr size_tcapacity() { return Capacity; }42 constexpr size_tsize() const { return m_size; }43 44 inline void size( size_tnew_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; } 47 47 48 48 SizeType m_size = 0; … … 52 52 struct growing_storage_size< SizeType, 0 > 53 53 { 54 static constexpr size_t max_size() { return size_t( 0x80000000 ); }55 constexpr size_tcapacity() const { return m_capacity; }56 constexpr size_tsize() const { return m_size; }57 58 inline void capacity( size_tnew_capacity ) { m_capacity = static_cast< SizeType >( new_capacity ); }59 inline void size( size_tnew_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; } 62 62 63 63 SizeType m_size = 0; … … 69 69 typename Storage, 70 70 typename InitializePolicy = policy_initialize_standard, 71 typename SizeType = size_t,72 size_tCapacity = 0,73 typename NextCapacity = default_next_capacity< size_t>71 typename SizeType = uint32, 72 uint32 Capacity = 0, 73 typename NextCapacity = default_next_capacity< uint32 > 74 74 > 75 75 class growing_storage : public Storage … … 78 78 typedef detail::growing_storage_size< SizeType, Capacity > size_impl_type; 79 79 typedef typename Storage::value_type value_type; 80 typedef size_tsize_type;80 typedef uint32 size_type; 81 81 typedef SizeType size_store_type; 82 82 typedef value_type* iterator; … … 298 298 } 299 299 300 template< size_tC = 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 ) 302 302 { 303 303 return false; 304 304 } 305 305 306 template< size_tC = Capacity >307 enable_if_t< C == 0, bool > try_reallocate( size_tnew_capacity, bool copy_needed )306 template< uint32 C = Capacity > 307 enable_if_t< C == 0, bool > try_reallocate( uint32 new_capacity, bool copy_needed ) 308 308 { 309 309 if ( new_capacity > 0 && Storage::reallocate( new_capacity, copy_needed ) ) … … 316 316 317 317 // TODO: return type error checking 318 bool try_grow( size_t amount, size_textra = 0 )318 bool try_grow( uint32 amount, uint32 extra = 0 ) 319 319 { 320 320 size_type new_size = amount + m_size + extra; … … 329 329 330 330 // TODO: return type error checking 331 bool try_reserve( size_tnew_capacity, bool copy_needed )331 bool try_reserve( uint32 new_capacity, bool copy_needed ) 332 332 { 333 333 if ( new_capacity > m_size.capacity() ) … … 338 338 } 339 339 // TODO: return type error checking 340 bool try_resize( size_t new_size, bool copy_needed, size_textra = 0 )340 bool try_resize( uint32 new_size, bool copy_needed, uint32 extra = 0 ) 341 341 { 342 342 if ( new_size > m_size ) -
trunk/nv/stl/container/hash_table.hh
r532 r533 151 151 typedef table_iterator< true > const_iterator; 152 152 153 typedef size_tsize_type;153 typedef uint32 size_type; 154 154 typedef node_type* bucket_type; 155 155 … … 160 160 } 161 161 162 explicit hash_table_storage( size_tcount )162 explicit hash_table_storage( uint32 count ) 163 163 : m_buckets( nullptr ), m_bucket_count( 0 ), m_element_count( 0 ), m_max_load_factor( 1.0f ) 164 164 { … … 301 301 bool rehash_check( size_type new_elements ) 302 302 { 303 size_tnew_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 ); 304 304 if ( new_buckets ) 305 305 { … … 365 365 } 366 366 367 size_type bucket_index( hash_type hash_code, size_tb_count ) const367 size_type bucket_index( hash_type hash_code, uint32 b_count ) const 368 368 { 369 369 return RehashPolicy::template get_index<hash_type>( hash_code, b_count ); … … 432 432 typedef typename HashEntryPolicy::key_type key_type; 433 433 typedef typename HashEntryPolicy::mapped_type mapped_type; 434 typedef size_tsize_type;434 typedef uint32 size_type; 435 435 typedef ptrdiff_t difference_type; 436 436 typedef value_type& reference; -
trunk/nv/stl/container/hash_table_policy.hh
r432 r533 145 145 { 146 146 template< typename H > 147 static enable_if_t< is_integral< H >::value, size_t>148 get_index( H h, size_tn ) { return h % n; }147 static enable_if_t< is_integral< H >::value, uint32 > 148 get_index( H h, uint32 n ) { return h % n; } 149 149 150 150 template< typename H > 151 static enable_if_t< is_class< H >::value, size_t>152 get_index( H h, size_tn ) { 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; } 153 153 154 154 -
trunk/nv/stl/container/initialize_policy.hh
r434 r533 1 // Copyright (C) 2015 ChaosForge Ltd1 // Copyright (C) 2015-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/stl/container/random_access.hh
r520 r533 1 // Copyright (C) 2015 ChaosForge Ltd1 // Copyright (C) 2015-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 59 59 inline const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); } 60 60 inline const_reverse_iterator crend() const { return const_reverse_iterator( begin() ); } 61 inline const_iterator iat( size_ti ) 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; } 62 62 }; 63 63 … … 114 114 inline const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); } 115 115 inline const_reverse_iterator crend() const { return const_reverse_iterator( begin() ); } 116 inline const_iterator iat( size_ti ) const { NV_ASSERT( i <= Super::size(), "Index out of range" ); return begin() + i; }117 inline iterator iat( size_ti ) { 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; } 118 118 }; 119 119 } -
trunk/nv/stl/container/sized_storage.hh
r435 r533 23 23 typename Storage, 24 24 typename InitializePolicy = policy_initialize_standard, 25 typename SizeType = size_t25 typename SizeType = uint32 26 26 > 27 27 class sized_storage : public Storage 28 28 { 29 29 public: 30 typedef size_tsize_type;30 typedef uint32 size_type; 31 31 typedef SizeType size_store_type; 32 32 typedef typename Storage::value_type value_type; … … 132 132 133 133 // TODO: return type error checking 134 bool try_resize( size_tnew_size, bool copy_needed )134 bool try_resize( uint32 new_size, bool copy_needed ) 135 135 { 136 136 if ( new_size != m_size ) -
trunk/nv/stl/functional/hash.hh
r518 r533 54 54 } 55 55 template < typename T > 56 static constexpr H hash( const T* p, size_tsz, H basis = hash_basis )56 static constexpr H hash( const T* p, uint32 sz, H basis = hash_basis ) 57 57 { 58 58 return p != nullptr ? hash_impl( reinterpret_cast<const char*>(p), sizeof(T)*sz, basis ) : 0; … … 63 63 return c == 0 ? value : str_hash_impl( remain[0], remain + 1, static_cast<H>( value ^ static_cast<H>( c ) ) * hash_prime ); 64 64 } 65 static constexpr H hash_impl( const char* current, size_tremain, H value )65 static constexpr H hash_impl( const char* current, uint32 remain, H value ) 66 66 { 67 67 return remain == 0 ? value : hash_impl( current + 1, remain - 1, static_cast<H>( value ^ static_cast<H>( current[0] ) ) * hash_prime ); … … 156 156 157 157 template < typename H > 158 constexpr H hash_string( const char* s, size_tlength )158 constexpr H hash_string( const char* s, uint32 length ) 159 159 { 160 160 return detail::fnv_hash<H>::hash( s, length ); … … 257 257 constexpr uint32 operator "" _h32( const char* str, size_t len ) 258 258 { 259 return detail::fnv_hash< uint32 >::hash( str, len);259 return detail::fnv_hash< uint32 >::hash( str, static_cast< uint32 >( len ) ); 260 260 } 261 261 262 262 constexpr uint64 operator "" _h64( const char* str, size_t len ) 263 263 { 264 return detail::fnv_hash< uint64 >::hash( str, len);264 return detail::fnv_hash< uint64 >::hash( str, static_cast< uint32 >( len ) ); 265 265 } 266 266 -
trunk/nv/stl/handle.hh
r530 r533 46 46 47 47 constexpr T index() const { return m_index; } 48 // size_thash() const { return hash<T>()( T( m_counter << IBITS | m_index ) ); }49 constexpr size_thash() 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; } 50 50 protected: 51 51 T m_index : IBITS; -
trunk/nv/stl/index_table.hh
r530 r533 76 76 index_type remove_swap( index_type dead_eindex ) 77 77 { 78 if ( size_t( dead_eindex ) >= m_handles.size() ) return -1;78 if ( uint32( dead_eindex ) >= m_handles.size() ) return -1; 79 79 handle_type h = m_handles[dead_eindex]; 80 80 handle_type swap_handle = m_handles.back(); … … 98 98 handle_type get_handle( index_type i ) const { return m_handles[unsigned( i )]; } 99 99 100 size_tsize() const { return m_handles.size(); }100 uint32 size() const { return m_handles.size(); } 101 101 102 102 private: … … 108 108 if ( size == 0 ) size = 1; 109 109 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 ); 111 111 } 112 112 } -
trunk/nv/stl/memory.hh
r498 r533 1 // Copyright (C) 2015 ChaosForge Ltd1 // Copyright (C) 2015-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 36 36 public: 37 37 typedef T value_type; 38 typedef size_tsize_type;38 typedef uint32 size_type; 39 39 typedef ptrdiff_t difference_type; 40 40 typedef value_type* pointer; … … 55 55 constexpr array_ref( value_type* a_data, size_type a_size ) 56 56 : m_data( a_data ), m_size( a_size ) {} 57 template< size_tN >57 template< uint32 N > 58 58 constexpr explicit array_ref( value_type( &a_data )[N] ) 59 59 : m_data( a_data ), m_size( N ) {} … … 65 65 } 66 66 67 constexpr size_t size() const { return m_size; }67 constexpr size_type size() const { return m_size; } 68 68 constexpr bool empty() const { return m_size != 0; } 69 69 constexpr const value_type* data() const { return m_data; } … … 85 85 constexpr const_reverse_iterator crbegin() const { return const_reverse_iterator( end() ); } 86 86 constexpr const_reverse_iterator crend() const { return const_reverse_iterator( begin() ); } 87 inline const_iterator iat( size_ti ) const { NV_ASSERT_ALWAYS( i <= m_size, "Index out of range" ); return begin() + i; }88 inline iterator iat( size_ti ) { 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; } 89 89 90 90 inline reference front() { NV_ASSERT_ALWAYS( !empty(), "front() called on empty data!" ); return m_data[0]; } … … 107 107 public: 108 108 typedef T value_type; 109 typedef size_tsize_type;109 typedef uint32 size_type; 110 110 typedef ptrdiff_t difference_type; 111 111 typedef const value_type* pointer; … … 128 128 constexpr array_view( const array_ref<T>& view ) 129 129 : m_data( view.data() ), m_size( view.size() ) {} 130 template< size_tN >130 template< uint32 N > 131 131 constexpr explicit array_view( const value_type( &a_data )[N] ) 132 132 : m_data( a_data ), m_size( N ) {} … … 156 156 inline const_reference back() const { NV_ASSERT_ALWAYS( !empty(), "front() called on empty data!" ); return m_data[m_size - 1]; } 157 157 158 inline const_iterator iat( size_ti ) 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; } 159 159 const_reference operator[]( size_type i ) const { NV_ASSERT_ALWAYS( i < m_size, "Out of range" ); return m_data[i]; } 160 160 -
trunk/nv/stl/string.hh
r487 r533 59 59 inline string_view trimmed( const string_view& str ) 60 60 { 61 size_tendpos = str.find_last_not_of( " \r\n\t" );62 size_tstartpos = 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" ); 63 63 64 64 if ( string_view::npos != endpos || string_view::npos != startpos ) … … 73 73 inline string_view rtrimmed( const string_view& str ) 74 74 { 75 size_tendpos = str.find_last_not_of( " \r\n\t" );75 uint32 endpos = str.find_last_not_of( " \r\n\t" ); 76 76 if ( string_view::npos != endpos ) 77 77 { … … 83 83 inline string_view ltrimmed( const string_view& str ) 84 84 { 85 size_tstartpos = str.find_first_not_of( " \r\n\t" );85 uint32 startpos = str.find_first_not_of( " \r\n\t" ); 86 86 if ( string_view::npos != startpos ) 87 87 { … … 94 94 inline string_view extract_extension( string_view filename ) 95 95 { 96 size_tlastdot = filename.find_last_of( '.' );96 uint32 lastdot = filename.find_last_of( '.' ); 97 97 if ( string_view::npos != lastdot ) 98 98 return filename.substr( lastdot + 1 ); … … 102 102 inline string_view without_extension( string_view filename ) 103 103 { 104 size_tlastdot = filename.find_last_of( '.' );104 uint32 lastdot = filename.find_last_of( '.' ); 105 105 if ( string_view::npos != lastdot ) 106 106 return filename.substr( 0, lastdot ); … … 124 124 template < typename S > 125 125 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_tlen ) : inherited_type( hash_string< H >( str, len ) ) {}126 constexpr string_hash( const char* str, uint32 len ) : inherited_type( hash_string< H >( str, len ) ) {} 127 127 constexpr string_hash( const char* str ) : inherited_type( hash_string< H >( str ) ) {} 128 128 129 129 // Literal constructors 130 130 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 ) ) ) {} 132 132 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 ) ) ) {} 134 134 135 135 constexpr explicit string_hash( hash_type value ) : inherited_type( value ) {} … … 141 141 constexpr shash32 operator "" _sh32( const char* str, size_t len ) 142 142 { 143 return shash32( detail::fnv_hash< uint32 >::hash( str, len) );143 return shash32( detail::fnv_hash< uint32 >::hash( str, static_cast< uint32 >( len ) ) ); 144 144 } 145 145 146 146 constexpr shash64 operator "" _sh64( const char* str, size_t len ) 147 147 { 148 return shash64( detail::fnv_hash< uint64 >::hash( str, len) );148 return shash64( detail::fnv_hash< uint64 >::hash( str, static_cast< uint32 >( len ) ) ); 149 149 } 150 150 } -
trunk/nv/stl/string/const_string.hh
r438 r533 25 25 inline explicit const_string( const char* str ) 26 26 { 27 initialize( str, nvstrlen( str) );27 initialize( str, static_cast< uint32 >( nvstrlen( str ) ) ); 28 28 } 29 29 inline const_string( const string_view& rhs ) … … 34 34 inline const_string( char( &s )[N] ) 35 35 { 36 initialize( s, N-1);36 initialize( s, static_cast< uint32 >( N-1 ) ); 37 37 } 38 38 template< size_t N > 39 39 inline const_string( const char( &s )[N] ) 40 40 { 41 initialize( s, N - 1);41 initialize( s, static_cast< uint32 >( N - 1 ) ); 42 42 } 43 43 // TODO : implement -
trunk/nv/stl/string/literal_string.hh
r433 r533 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 16 16 class literal_string : public string_base< array_view< char > > 17 17 { 18 constexpr literal_string( const char* str, size_tlen ) : this_type( str, len ) {}18 constexpr literal_string( const char* str, uint32 len ) : this_type( str, len ) {} 19 19 public: 20 20 typedef string_base< array_view< char > > this_type; … … 22 22 23 23 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 ) ) {} 25 25 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 ) ) {} 27 27 }; 28 28 29 29 constexpr literal_string operator "" _ls( const char* str, size_t len ) 30 30 { 31 return literal_string( str, len);31 return literal_string( str, static_cast< uint32 >( len ) ); 32 32 } 33 33 … … 40 40 class hashed_literal_string : public string_base< array_view< char > > 41 41 { 42 constexpr hashed_literal_string( const char* str, size_tlen, H hash_code )42 constexpr hashed_literal_string( const char* str, uint32 len, H hash_code ) 43 43 : this_type( str, len ), m_hash( hash_code ) {} 44 44 public: … … 67 67 constexpr hashed_literal_string_32 operator "" _hls32( const char* str, size_t len ) 68 68 { 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 ) ) ); 70 70 } 71 71 72 72 constexpr hashed_literal_string_64 operator "" _hls64( const char* str, size_t len ) 73 73 { 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 ) ) ); 75 75 } 76 76 -
trunk/nv/stl/string/string_base.hh
r472 r533 16 16 { 17 17 18 size_tsint32_to_buffer( array_ref< char > buffer, sint32 n );19 size_tsint64_to_buffer( array_ref< char > buffer, sint64 n );20 size_tuint32_to_buffer( array_ref< char > buffer, uint32 n );21 size_tuint64_to_buffer( array_ref< char > buffer, uint64 n );22 size_tf32_to_buffer( array_ref< char > buffer, f32 n );23 size_tf64_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 ); 24 24 25 25 sint32 buffer_to_sint32( const char* str, char** end ); … … 90 90 size_type reverse_distance( ReverseIterator first, ReverseIterator last ) const 91 91 { 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 ) ); 93 93 } 94 94 }; … … 124 124 // Non-literal constructors 125 125 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 ) {} 127 127 128 128 // Non-literal constructors 129 129 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 ) ) ) {} 131 131 132 132 inline string_view& operator=( const string_view &rhs ) -
trunk/nv/stl/string/string_twine.hh
r440 r533 75 75 string_twine( const string_twine& s ) = default; 76 76 77 string_twine( const char* data, size_tsz )77 string_twine( const char* data, uint32 sz ) 78 78 : m_lhs( data, sz ), m_rhs() 79 79 { … … 102 102 } 103 103 104 size_tdump_size() const104 uint32 dump_size() const 105 105 { 106 106 return dump_size( m_lhs ) + dump_size( m_rhs ); … … 114 114 struct twine_cstring 115 115 { 116 size_tsize;116 uint32 size; 117 117 const char* data; 118 118 }; … … 141 141 twine_node( const string_twine* v ) : type( TWINE ) { value.twine = v; } 142 142 twine_node( const string_view* v ) : type( STRING ) { value.string = v; } 143 twine_node( const char* d, size_ts ) : 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; } 144 144 }; 145 145 … … 168 168 } 169 169 170 size_tdump_size( const twine_node& node ) const170 uint32 dump_size( const twine_node& node ) const 171 171 { 172 172 switch ( node.type ) … … 201 201 void dump_string( array_ref< char >& target, const string_view& string ) const 202 202 { 203 size_tdump_length = nv::min( target.size(), string.size() );203 uint32 dump_length = nv::min( target.size(), string.size() ); 204 204 if ( dump_length > 0 ) 205 205 { … … 219 219 inline string_twine operator+( const char (&lhs)[N], const string_twine& rhs ) 220 220 { 221 return string_twine( lhs, N-1).concat( rhs );221 return string_twine( lhs, static_cast< uint32 >( N-1 ) ).concat( rhs ); 222 222 } 223 223 … … 225 225 inline string_twine operator+( const string_twine& lhs, const char( &rhs )[N] ) 226 226 { 227 return lhs.concat( string_twine( rhs, N - 1) );227 return lhs.concat( string_twine( rhs, static_cast< uint32 >( N - 1 ) ) ); 228 228 } 229 229 -
trunk/nv/stl/vector.hh
r434 r533 1 // Copyright (C) 2014-201 5ChaosForge Ltd1 // Copyright (C) 2014-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 25 25 using growable_dynamic_storage = growing_storage< dynamic_storage< T > >; 26 26 27 template< typename T, size_tN >27 template< typename T, uint32 N > 28 28 using growable_static_storage = growing_storage< static_storage< T, N > >; 29 29 -
trunk/nv_bullet.lua
r520 r533 27 27 links { "nv-core", "nv-gl", "nv-formats", "nv-lua", "nv-lib", "nv-io", "nv-gfx" } 28 28 29 includedirs { "D:/Libraries/bullet2/src/" } 30 29 31 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" ) 31 34 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" ) 34 50 35 51 52 -
trunk/src/core/logger.cc
r402 r533 144 144 { 145 145 char stamp[16]; 146 size_tssize = timestamp( stamp );146 uint32 ssize = timestamp( stamp ); 147 147 148 148 #if NV_COMPILER == NV_MSVC … … 180 180 { 181 181 char stamp[16]; 182 size_tssize = timestamp( stamp );182 uint32 ssize = timestamp( stamp ); 183 183 #if 0 // NV_PLATFORM == NV_WINDOWS 184 184 // Turns out WriteFile on Windows is unbuffered and quite slower than fwrite … … 242 242 } 243 243 244 nv:: size_tnv::log_sink::timestamp( char* buffer ) const244 nv::uint32 nv::log_sink::timestamp( char* buffer ) const 245 245 { 246 246 uint32 ms = get_system_ms(); -
trunk/src/core/profiler.cc
r409 r533 109 109 char buffer[128]; 110 110 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 ) ) ) ); 112 112 log_node_children( 0, m_root ); 113 113 NV_LOG_INFO( "-- PROFILER REPORT END ---------------------------------" ); … … 131 131 snprintf( buffer + indent, 128 - indent, "%*.*s %6.2f %6d %9.2f %6.2f", indent - 23, 23 - indent, 132 132 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 ) ) ) ); 134 134 if ( c->m_children.size() > 0 ) 135 135 { -
trunk/src/core/random.cc
r509 r533 16 16 static const uint32 mt_matrix_a = 0x9908B0DFUL; 17 17 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)) ) 20 20 21 21 nv::random& random::get() … … 43 43 { 44 44 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++ ) 47 49 *p = p[mersenne_m] ^ NV_MT_TWIST( p[0], p[1] ); 48 50 49 51 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] ); 53 57 54 58 m_remaining = mersenne_n; -
trunk/src/gfx/texture_atlas.cc
r471 r533 11 11 using namespace nv; 12 12 13 texture_atlas::texture_atlas( ivec2 size, nv::size_t depth, nv::size_tborder /*= 1*/ )13 texture_atlas::texture_atlas( ivec2 size, uint32 depth, uint32 border /*= 1*/ ) 14 14 : image( size, depth ), m_used( 0 ), m_border( border ) 15 15 { … … 26 26 int best_width = nv::limits::si_max; 27 27 28 for( size_ti=0; i < m_nodes.size(); ++i )28 for( uint32 i=0; i < m_nodes.size(); ++i ) 29 29 { 30 30 int y = fit( i, size ); … … 51 51 m_nodes.insert( m_nodes.begin() + best_index, ivec3( r.pos.x, r.pos.y + size.y, size.x ) ); 52 52 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 ) 54 54 { 55 55 ivec3 node = m_nodes[ i ]; … … 82 82 } 83 83 84 int texture_atlas::fit( nv::size_tindex, ivec2 size )84 int texture_atlas::fit( uint32 index, ivec2 size ) 85 85 { 86 86 ivec3 node = m_nodes[ index ]; … … 113 113 void texture_atlas::merge() 114 114 { 115 for ( size_ti=0; i < m_nodes.size()-1; ++i )115 for ( uint32 i=0; i < m_nodes.size()-1; ++i ) 116 116 { 117 117 if ( m_nodes[ i ].y == m_nodes[ i+1 ].y ) -
trunk/src/gl/gl_device.cc
r506 r533 452 452 glGetActiveUniform( p->glid, i, 128, &uni_nlen, &uni_len, &uni_type, name_buffer ); 453 453 454 string_view name( name_buffer, size_t( uni_nlen ) );454 string_view name( name_buffer, uint32( uni_nlen ) ); 455 455 456 456 // skip built-ins … … 461 461 462 462 // check for array 463 size_tarrchar = name.find( '[' );463 uint32 arrchar = name.find( '[' ); 464 464 if ( arrchar != string_view::npos ) 465 465 { -
trunk/src/image/miniz.cc
r520 r533 3 3 4 4 using namespace nv; 5 6 #define MINIZ_NO_TIME7 #define MINIZ_NO_ZLIB_COMPATIBLE_NAMES8 9 #define MINIZ_HAS_64BIT_REGISTERS 010 #define TINFL_USE_64BIT_BITBUF 011 5 12 6 #if NV_COMPILER == NV_CLANG … … 17 11 18 12 #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 121 #endif22 23 #if (__BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU24 // Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian.25 #define MINIZ_LITTLE_ENDIAN 126 #endif27 28 #if MINIZ_X86_OR_X64_CPU29 13 // Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses. 30 14 #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 31 #endif32 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 136 15 #endif 37 16 … … 204 183 const char *mz_error( int err ); 205 184 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_NAMES209 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 0221 #define Z_NO_FLUSH MZ_NO_FLUSH222 #define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH223 #define Z_SYNC_FLUSH MZ_SYNC_FLUSH224 #define Z_FULL_FLUSH MZ_FULL_FLUSH225 #define Z_FINISH MZ_FINISH226 #define Z_BLOCK MZ_BLOCK227 #define Z_OK MZ_OK228 #define Z_STREAM_END MZ_STREAM_END229 #define Z_NEED_DICT MZ_NEED_DICT230 #define Z_ERRNO MZ_ERRNO231 #define Z_STREAM_ERROR MZ_STREAM_ERROR232 #define Z_DATA_ERROR MZ_DATA_ERROR233 #define Z_MEM_ERROR MZ_MEM_ERROR234 #define Z_BUF_ERROR MZ_BUF_ERROR235 #define Z_VERSION_ERROR MZ_VERSION_ERROR236 #define Z_PARAM_ERROR MZ_PARAM_ERROR237 #define Z_NO_COMPRESSION MZ_NO_COMPRESSION238 #define Z_BEST_SPEED MZ_BEST_SPEED239 #define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION240 #define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION241 #define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY242 #define Z_FILTERED MZ_FILTERED243 #define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY244 #define Z_RLE MZ_RLE245 #define Z_FIXED MZ_FIXED246 #define Z_DEFLATED MZ_DEFLATED247 #define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS248 #define alloc_func mz_alloc_func249 #define free_func mz_free_func250 #define internal_state mz_internal_state251 #define z_stream mz_stream252 #define deflateInit mz_deflateInit253 #define deflateInit2 mz_deflateInit2254 #define deflateReset mz_deflateReset255 #define deflate mz_deflate256 #define deflateEnd mz_deflateEnd257 #define deflateBound mz_deflateBound258 #define compress mz_compress259 #define compress2 mz_compress2260 #define compressBound mz_compressBound261 #define inflateInit mz_inflateInit262 #define inflateInit2 mz_inflateInit2263 #define inflate mz_inflate264 #define inflateEnd mz_inflateEnd265 #define uncompress mz_uncompress266 #define crc32 mz_crc32267 #define adler32 mz_adler32268 #define MAX_WBITS 15269 #define MAX_MEM_LEVEL 9270 #define zError mz_error271 #define ZLIB_VERSION MZ_VERSION272 #define ZLIB_VERNUM MZ_VERNUM273 #define ZLIB_VER_MAJOR MZ_VER_MAJOR274 #define ZLIB_VER_MINOR MZ_VER_MINOR275 #define ZLIB_VER_REVISION MZ_VER_REVISION276 #define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION277 #define zlibVersion mz_version278 #define zlib_version mz_version()279 #endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES280 185 281 186 #endif // MINIZ_NO_ZLIB_APIS … … 321 226 mz_uint16 m_bit_flag; 322 227 mz_uint16 m_method; 323 #ifndef MINIZ_NO_TIME 324 time_t m_time; 325 #endif 228 // time_t m_time; 229 326 230 mz_uint32 m_crc32; 327 231 mz_uint64 m_comp_size; … … 567 471 } tinfl_huff_table; 568 472 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 574 474 typedef mz_uint64 tinfl_bit_buf_t; 575 475 #define TINFL_BITBUF_SIZE (64) … … 766 666 #define MZ_CLEAR_OBJ(obj) nvmemset(&(obj), 0, sizeof(obj)) 767 667 768 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN668 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN 769 669 #define MZ_READ_LE16(p) *((const mz_uint16 *)(p)) 770 670 #define MZ_READ_LE32(p) *((const mz_uint32 *)(p)) … … 1382 1282 { 1383 1283 int sym2; mz_uint code_len; 1384 #if TINFL_USE_64BIT_BITBUF1284 #if NV_ARCHITECTURE == NV_64BIT 1385 1285 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; } 1386 1286 #else … … 1397 1297 break; 1398 1298 1399 #if !TINFL_USE_64BIT_BITBUF1299 #if NV_ARCHITECTURE == NV_32BIT 1400 1300 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; } 1401 1301 #endif … … 1835 1735 static const mz_uint mz_bitmasks[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; 1836 1736 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 1838 1739 static mz_bool tdefl_compress_lz_codes( tdefl_compressor *d ) 1839 1740 { … … 1968 1869 return ( d->m_pOutput_buf < d->m_pOutput_buf_end ); 1969 1870 } 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 1971 1873 1972 1874 static mz_bool tdefl_compress_block( tdefl_compressor *d, mz_bool static_block ) … … 2145 2047 #endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES 2146 2048 2147 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN2049 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN 2148 2050 static mz_bool tdefl_compress_fast( tdefl_compressor *d ) 2149 2051 { … … 2480 2382 return ( d->m_prev_return_status = tdefl_flush_output_buffer( d ) ); 2481 2383 2482 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN2384 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN 2483 2385 if ( ( ( d->m_flags & TDEFL_MAX_PROBES_MASK ) == 1 ) && 2484 2386 ( ( d->m_flags & TDEFL_GREEDY_PARSING_FLAG ) != 0 ) && … … 2489 2391 } 2490 2392 else 2491 #endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN2393 #endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN 2492 2394 { 2493 2395 if ( !tdefl_compress_normal( d ) ) -
trunk/src/io/c_file_system.cc
r438 r533 48 48 stream* fstream = open( path, "rb" ); 49 49 if ( !fstream ) return const_string(); 50 uint32 size = fstream->size();50 uint32 size = static_cast< uint32 >( fstream->size() ); 51 51 const_string result( nullptr, size ); 52 52 fstream->read( const_cast<char*>( result.data() ), size, 1 ); -
trunk/src/lua/lua_state.cc
r515 r533 172 172 } 173 173 174 nv:: size_tlua::table_guard::get_size()174 nv::uint32 lua::table_guard::get_size() 175 175 { 176 176 return nlua_rawlen( m_state, -1 ); … … 194 194 { 195 195 str = lua_tolstring( m_state, -1, &l ); 196 result = hash_string< uint64 >( str, l);196 result = hash_string< uint64 >( str, static_cast< uint32 >( l ) ); 197 197 //NV_LOG_DEBUG( str ); 198 198 } … … 210 210 { 211 211 str = lua_tolstring( m_state, -1, &l ); 212 string_view sv( str, l);212 string_view sv( str, static_cast< uint32 >( l ) ); 213 213 result = table ? table->insert( sv ) : shash64( sv ); 214 214 } … … 226 226 { 227 227 str = lua_tolstring( m_state, -1, &l ); 228 result = hash_string< uint64 >( str, l);228 result = hash_string< uint64 >( str, static_cast< uint32 >( l ) ); 229 229 //NV_LOG_DEBUG( str ); 230 230 } … … 247 247 str = defval.data(); 248 248 } 249 string128 result( str, l);249 string128 result( str, static_cast< uint32 >( l ) ); 250 250 lua_pop( m_state, 1 ); 251 251 return result; … … 266 266 str = defval.data(); 267 267 } 268 const_string result( str, l);268 const_string result( str, static_cast< uint32 >( l ) ); 269 269 lua_pop( m_state, 1 ); 270 270 return result; … … 280 280 { 281 281 str = lua_tolstring( m_state, -1, &l ); 282 string_view sv( str, l);282 string_view sv( str, static_cast< uint32 >( l ) ); 283 283 result = table ? table->insert( sv ) : shash64( sv ); 284 284 } … … 301 301 str = defval.data(); 302 302 } 303 const_string result( str, l);303 const_string result( str, static_cast< uint32 >( l ) ); 304 304 lua_pop( m_state, 1 ); 305 305 return result; … … 320 320 str = defval.data(); 321 321 } 322 string128 result( str, l);322 string128 result( str, static_cast< uint32 >( l ) ); 323 323 lua_pop( m_state, 1 ); 324 324 return result; … … 339 339 str = defval.data(); 340 340 } 341 string64 result( str, l);341 string64 result( str, static_cast< uint32 >( l ) ); 342 342 lua_pop( m_state, 1 ); 343 343 return result; … … 359 359 str = defval.data(); 360 360 } 361 string32 result( str, l);361 string32 result( str, static_cast< uint32 >( l ) ); 362 362 lua_pop( m_state, 1 ); 363 363 return result; -
trunk/src/lua/lua_values.cc
r490 r533 105 105 size_t length = 0; 106 106 const char* result = lua_tolstring( L, index, &length ); 107 return string_view( result, length);107 return string_view( result, static_cast< uint32 >( length ) ); 108 108 } 109 109 -
trunk/src/stl/string.cc
r442 r533 27 27 } 28 28 29 nv:: size_tnv::sint32_to_buffer( array_ref< char > buffer, sint32 n )29 nv::uint32 nv::sint32_to_buffer( array_ref< char > buffer, sint32 n ) 30 30 { 31 31 if ( buffer.size() < 2 ) return 0; … … 46 46 *s = '\0'; 47 47 string_reverse( buffer.begin(), s - 1 ); 48 return static_cast<nv:: size_t>( s - buffer.begin() );49 } 50 51 nv:: size_tnv::sint64_to_buffer( array_ref< char > buffer, sint64 n )48 return static_cast<nv::uint32>( s - buffer.begin() ); 49 } 50 51 nv::uint32 nv::sint64_to_buffer( array_ref< char > buffer, sint64 n ) 52 52 { 53 53 if ( buffer.size() < 2 ) return 0; … … 68 68 *s = '\0'; 69 69 string_reverse( buffer.begin(), s - 1 ); 70 return static_cast<nv:: size_t>( s - buffer.begin() );71 } 72 73 nv:: size_tnv::uint32_to_buffer( array_ref< char > buffer, uint32 n )70 return static_cast<nv::uint32>( s - buffer.begin() ); 71 } 72 73 nv::uint32 nv::uint32_to_buffer( array_ref< char > buffer, uint32 n ) 74 74 { 75 75 if ( buffer.size() < 2 ) return 0; … … 84 84 *s = '\0'; 85 85 string_reverse( buffer.begin(), s - 1 ); 86 return static_cast<nv:: size_t>( s - buffer.begin() );87 } 88 89 nv:: size_tnv::uint64_to_buffer( array_ref< char > buffer, uint64 n )86 return static_cast<nv::uint32>( s - buffer.begin() ); 87 } 88 89 nv::uint32 nv::uint64_to_buffer( array_ref< char > buffer, uint64 n ) 90 90 { 91 91 if ( buffer.size() < 2 ) return 0; … … 100 100 *s = '\0'; 101 101 string_reverse( buffer.begin(), s - 1 ); 102 return static_cast<nv:: size_t>( s - buffer.begin() );103 } 104 105 nv:: size_tnv::f32_to_buffer( array_ref< char > buffer, f32 n )102 return static_cast<nv::uint32>( s - buffer.begin() ); 103 } 104 105 nv::uint32 nv::f32_to_buffer( array_ref< char > buffer, f32 n ) 106 106 { 107 107 #if NV_COMPILER == NV_MSVC … … 110 110 int result = snprintf( buffer.data(), buffer.size(), "%.*g", 6, n ); 111 111 #endif 112 return static_cast<nv:: size_t>( result > 0 ? result : 0 );113 } 114 115 nv:: size_tnv::f64_to_buffer( array_ref< char > buffer, f64 n )112 return static_cast<nv::uint32>( result > 0 ? result : 0 ); 113 } 114 115 nv::uint32 nv::f64_to_buffer( array_ref< char > buffer, f64 n ) 116 116 { 117 117 #if NV_COMPILER == NV_MSVC … … 120 120 int result = snprintf( buffer.data(), buffer.size(), "%.*g", 6, n ); 121 121 #endif 122 return static_cast<nv:: size_t>( result > 0 ? result : 0 );122 return static_cast<nv::uint32>( result > 0 ? result : 0 ); 123 123 } 124 124
Note: See TracChangeset
for help on using the changeset viewer.