- Timestamp:
- 06/04/15 18:46:42 (10 years ago)
- Location:
- trunk/nv/stl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/stl/array.hh
r383 r384 35 35 static SizeType get( SizeType requested, SizeType capacity, SizeType max_size ) 36 36 { 37 SizeType minimum = nv::min<SizeType>( capacity, 4 ); 37 38 SizeType remaining = max_size - capacity; 38 39 if ( remaining < requested ) return 0; 39 40 SizeType additional = nv::max( requested, capacity ); 40 return (remaining < additional ? max_size : capacity + additional );41 return nv::max( minimum, remaining < additional ? max_size : capacity + additional ); 41 42 } 42 43 }; … … 600 601 using vector = array_base_t < growing_container_allocator< growable_dynamic_storage< T > > >; 601 602 602 // template < typename T, typename ContainerAllocator >603 // class vector_base604 // {605 // public:606 // typedef T value_type;607 // typedef size_t size_type;608 // typedef ptrdiff_t difference_type;609 // typedef T* pointer;610 // typedef const T* const_pointer;611 // typedef T* iterator;612 // typedef const T* const_iterator;613 // typedef T& reference;614 // typedef const T& const_reference;615 //616 // protected:617 // ContainerAllocator m_storage;618 // };619 620 // template< typename T, size_t N >621 // class static_vector : public detail::pointer_iterators < static_vector< T, N >, T, false >622 // {623 // public:624 // typedef T value_type;625 // typedef size_t size_type;626 // typedef ptrdiff_t difference_type;627 // typedef T* pointer;628 // typedef const T* const_pointer;629 // typedef T* iterator;630 // typedef const T* const_iterator;631 // typedef T& reference;632 // typedef const T& const_reference;633 // typedef nv::reverse_iterator<iterator> reverse_iterator;634 // typedef nv::reverse_iterator<const_iterator> const_reverse_iterator;635 //636 // static_vector() : m_size(0) {}637 //638 // inline const_pointer data() const { return m_data; }639 // inline pointer data() { return m_data; }640 // inline size_type size() const { return m_size; }641 // inline bool empty() const { return !m_size; }642 // inline size_type raw_size() const { return N * sizeof( T ); }643 // inline const char* raw_data() const { return (const char*)m_data; }644 // inline char* raw_data() { return (char*)m_data; }645 //646 // inline reference front() { NV_ASSERT( !empty(), "front() called on empty data!" ); return m_data[0]; }647 // inline const_reference front() const { NV_ASSERT( !empty(), "front() called on empty data!" ); return m_data[0]; }648 // inline reference back() { NV_ASSERT( !empty(), "front() called on empty data!" ); return m_data[m_size - 1]; }649 // inline const_reference back() const { NV_ASSERT( !empty(), "front() called on empty data!" ); return m_data[m_size - 1]; }650 // protected:651 // value_type m_data[N];652 // size_type m_size;653 // };654 655 603 } 656 604 -
trunk/nv/stl/limits.hh
r382 r384 16 16 #include <nv/core/common.hh> 17 17 18 #if NV_COMPILER == NV_MSVC 19 #ifdef min 20 #undef min 21 #endif 22 #ifdef max 23 #undef max 24 #endif 25 #endif 26 18 27 namespace nv 19 28 { … … 22 31 static constexpr unsigned char uc_min = 0; 23 32 static constexpr unsigned char uc_max = 255; 24 static constexpr unsigned charuc_bit = sizeof( unsigned char ) * 8;33 static constexpr int uc_bit = sizeof( unsigned char ) * 8; 25 34 static constexpr signed char sc_min = -128; 26 35 static constexpr signed char sc_max = 127; 27 static constexpr signed charsc_bit = sizeof( signed char ) * 8;36 static constexpr int sc_bit = sizeof( signed char ) * 8; 28 37 static constexpr char c_min = ( char( 0 ) < char( -1 ) ? 0 : -128 ); 29 38 static constexpr char c_max = ( char( 0 ) < char( -1 ) ? 255 : 127 ); 30 static constexpr charc_bit = sizeof( char ) * 8;39 static constexpr int c_bit = sizeof( char ) * 8; 31 40 static constexpr unsigned short us_min = 0; 32 41 static constexpr unsigned short us_max = 65535; 33 static constexpr unsigned short us_bit = sizeof( unsigned short ) * 8;42 static constexpr int us_bit = sizeof( unsigned short ) * 8; 34 43 static constexpr signed short ss_min = -32768; 35 44 static constexpr signed short ss_max = 32767; 36 static constexpr signed short ss_bit = sizeof( signed short ) * 8;37 static constexpr unsigned int ui_min = 0 ;38 static constexpr unsigned int ui_max = 4294967295 ;39 static constexpr unsignedint ui_bit = sizeof( unsigned int ) * 8;40 static constexpr signed int si_min = -2147483648;45 static constexpr int ss_bit = sizeof( signed short ) * 8; 46 static constexpr unsigned int ui_min = 0UL; 47 static constexpr unsigned int ui_max = 4294967295UL; 48 static constexpr int ui_bit = sizeof( unsigned int ) * 8; 49 static constexpr signed int si_min = ( -2147483647 - 1 ); 41 50 static constexpr signed int si_max = 2147483647; 42 static constexpr signedint si_bit = sizeof( signed int ) * 8;43 static constexpr unsigned long ul_min = 0 ;44 static constexpr unsigned long ul_max = 4294967295 ;45 static constexpr unsigned longul_bit = sizeof( unsigned long ) * 8;46 static constexpr signed long sl_min = -2147483648;47 static constexpr signed long sl_max = 2147483647 ;48 static constexpr signed longsl_bit = sizeof( signed long ) * 8;49 static constexpr unsigned long long ull_min = 0 ;50 static constexpr unsigned long long ull_max = 18446744073709551615 ;51 static constexpr unsigned long longull_bit = sizeof( unsigned long long ) * 8;52 static constexpr signed long long sll_min = -9223372036854775808;53 static constexpr signed long long sll_max = 9223372036854775807 ;54 static constexpr signed long longsll_bit = sizeof( signed long long ) * 8;51 static constexpr int si_bit = sizeof( signed int ) * 8; 52 static constexpr unsigned long ul_min = 0UL; 53 static constexpr unsigned long ul_max = 4294967295UL; 54 static constexpr int ul_bit = sizeof( unsigned long ) * 8; 55 static constexpr signed long sl_min = ( -2147483647L -1 ); 56 static constexpr signed long sl_max = 2147483647L; 57 static constexpr int sl_bit = sizeof( signed long ) * 8; 58 static constexpr unsigned long long ull_min = 0ULL; 59 static constexpr unsigned long long ull_max = 18446744073709551615ULL; 60 static constexpr int ull_bit = sizeof( unsigned long long ) * 8; 61 static constexpr signed long long sll_min = ( -9223372036854775807LL - 1 ); 62 static constexpr signed long long sll_max = 9223372036854775807LL; 63 static constexpr int sll_bit = sizeof( signed long long ) * 8; 55 64 56 65 static constexpr int f_dig = 6; -
trunk/nv/stl/rtti_support.hh
r382 r384 61 61 } 62 62 63 // run-time hash64 inline uint64 rtti_hash( const char* str )65 {66 uint64 hash = detail::rtti_hash_basis;67 while ( *str != 0 )68 {69 hash ^= (uint64)str[0];70 hash *= detail::rtti_hash_prime;71 ++str;72 }73 return hash;74 }75 76 63 template < typename T > 77 64 struct rtti_type_hash
Note: See TracChangeset
for help on using the changeset viewer.