- Timestamp:
- 01/12/17 13:16:48 (8 years ago)
- Location:
- trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
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.