some more struct layout optimization

This commit is contained in:
Arvid Norberg 2011-09-22 10:37:47 +00:00
parent 5a7fe934bf
commit 976a50384a
3 changed files with 17 additions and 16 deletions

View File

@ -87,7 +87,7 @@ namespace libtorrent
return *this;
}
private:
unsigned int m_val;
boost::uint16_t m_val;
};
enum

View File

@ -1068,6 +1068,14 @@ namespace libtorrent
storage_constructor_type m_storage_constructor;
// the posix time this torrent was added and when
// it was completed. If the torrent isn't yet
// completed, m_completed_time is 0
time_t m_added_time;
time_t m_completed_time;
time_t m_last_seen_complete;
time_t m_last_saved_resume;
#ifndef TORRENT_DISABLE_ENCRYPTION
// this is SHA1("req2" + info-hash), used for
// encrypted hand shakes
@ -1093,14 +1101,6 @@ namespace libtorrent
boost::uint32_t m_total_failed_bytes;
boost::uint32_t m_total_redundant_bytes;
// the posix time this torrent was added and when
// it was completed. If the torrent isn't yet
// completed, m_completed_time is 0
time_t m_added_time;
time_t m_completed_time;
time_t m_last_seen_complete;
time_t m_last_saved_resume;
// ==============================
// The following members are specifically
// ordered to make the 24 bit members

View File

@ -255,6 +255,10 @@ namespace libtorrent
PRINT_OFFSETOF(torrent, m_resume_entry)
PRINT_OFFSETOF(torrent, m_name)
PRINT_OFFSETOF(torrent, m_storage_constructor)
PRINT_OFFSETOF(torrent, m_added_time)
PRINT_OFFSETOF(torrent, m_completed_time)
PRINT_OFFSETOF(torrent, m_last_seen_complete)
PRINT_OFFSETOF(torrent, m_last_saved_resume)
#ifndef TORRENT_DISABLE_ENCRYPTION
PRINT_OFFSETOF(torrent, m_obfuscated_hash)
#endif
@ -264,9 +268,6 @@ namespace libtorrent
PRINT_OFFSETOF(torrent, m_piece_time_deviation)
PRINT_OFFSETOF(torrent, m_total_failed_bytes)
PRINT_OFFSETOF(torrent, m_total_redundant_bytes)
PRINT_OFFSETOF(torrent, m_added_time)
PRINT_OFFSETOF(torrent, m_completed_time)
PRINT_OFFSETOF(torrent, m_last_seen_complete)
// PRINT_OFFSETOF(torrent, m_upload_mode_time:24)
// PRINT_OFFSETOF(torrent, m_state:3)
// PRINT_OFFSETOF(torrent, m_storage_mode:2)
@ -355,16 +356,16 @@ namespace libtorrent
, m_uuid(p.uuid)
, m_source_feed_url(p.source_feed_url)
, m_storage_constructor(p.storage)
, m_added_time(time(0))
, m_completed_time(0)
, m_last_seen_complete(0)
, m_last_saved_resume(time(0))
, m_ratio(0.f)
, m_available_free_upload(0)
, m_average_piece_time(0)
, m_piece_time_deviation(0)
, m_total_failed_bytes(0)
, m_total_redundant_bytes(0)
, m_added_time(time(0))
, m_completed_time(0)
, m_last_seen_complete(0)
, m_last_saved_resume(time(0))
, m_upload_mode_time(0)
, m_state(torrent_status::checking_resume_data)
, m_storage_mode(p.storage_mode)