diff options
author | 2016-07-31 11:50:20 +0200 | |
---|---|---|
committer | 2016-07-31 14:41:02 +0200 | |
commit | 9667c6a8cce1829a7321dde67bd0287c73234386 (patch) | |
tree | f3665957d557cb18728a40e75f7d9f2341aaff1d /src/lib/util/chd.cpp | |
parent | 69ac4affc86caac51ff9720083ed128dabdb932f (diff) |
std::min and std:max instead of MIN and MAX, also some more macros converted to inline functions (nw)
Diffstat (limited to 'src/lib/util/chd.cpp')
-rw-r--r-- | src/lib/util/chd.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/util/chd.cpp b/src/lib/util/chd.cpp index fd6f1c5ad1a..6d50ce1b571 100644 --- a/src/lib/util/chd.cpp +++ b/src/lib/util/chd.cpp @@ -242,7 +242,7 @@ inline UINT64 chd_file::file_append(const void *source, UINT32 length, UINT32 al delta = alignment - delta; while (delta != 0) { - UINT32 bytes_to_write = MIN(sizeof(buffer), delta); + UINT32 bytes_to_write = std::min(UINT32(sizeof(buffer)), delta); UINT32 count = m_file->write(buffer, bytes_to_write); if (count != bytes_to_write) throw CHDERR_WRITE_ERROR; @@ -1337,7 +1337,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex // read the metadata resultlen = metaentry.length; - file_read(metaentry.offset + METADATA_HEADER_SIZE, output, MIN(outputlen, resultlen)); + file_read(metaentry.offset + METADATA_HEADER_SIZE, output, std::min(outputlen, resultlen)); return CHDERR_NONE; } @@ -1959,7 +1959,7 @@ chd_error chd_file::compress_v5_map() else if (refhunk == last_self + 1) curcomp = COMPRESSION_SELF_1; else - max_self = MAX(max_self, refhunk); + max_self = std::max(max_self, refhunk); last_self = refhunk; } @@ -1974,13 +1974,13 @@ chd_error chd_file::compress_v5_map() else if (refunit == last_parent + m_hunkbytes / m_unitbytes) curcomp = COMPRESSION_PARENT_1; else - max_parent = MAX(max_parent, refunit); + max_parent = std::max(max_parent, UINT64(refunit)); last_parent = refunit; } // track maximum compressed length else //if (curcomp >= COMPRESSION_TYPE_0 && curcomp <= COMPRESSION_TYPE_3) - max_complen = MAX(max_complen, be_read(&m_rawmap[hunknum * 12 + 1], 3)); + max_complen = std::max(max_complen, UINT32(be_read(&m_rawmap[hunknum * 12 + 1], 3))); // TODO: check types // track repeats if (curcomp == lastcomp) @@ -2001,7 +2001,7 @@ chd_error chd_file::compress_v5_map() } else { - int this_count = MIN(count, 3+16+255); + int this_count = std::min(count, 3+16+255); encoder.histo_one(*dest++ = COMPRESSION_RLE_LARGE); encoder.histo_one(*dest++ = (this_count - 3 - 16) >> 4); encoder.histo_one(*dest++ = (this_count - 3 - 16) & 15); @@ -2333,7 +2333,7 @@ chd_error chd_file::create_common() UINT64 offset = m_mapoffset; while (mapsize != 0) { - UINT32 bytes_to_write = MIN(mapsize, sizeof(buffer)); + UINT32 bytes_to_write = std::min(mapsize, UINT32(sizeof(buffer))); file_write(offset, buffer, bytes_to_write); offset += bytes_to_write; mapsize -= bytes_to_write; |