Fixing MSVC warnings.

This commit is contained in:
Branimir Karadžić
2019-02-17 20:25:30 -08:00
parent f0947b794c
commit de2a1735b7
7 changed files with 11 additions and 11 deletions

View File

@@ -131,7 +131,7 @@ std::unique_ptr<ASTCFile> ASTCFile::LoadFile(const std::string& path,
} }
base::Optional<Footprint> ASTCFile::GetFootprint() const { base::Optional<Footprint> ASTCFile::GetFootprint() const {
return Footprint::FromDimensions(header_.block_width_, header_.block_height_); return Footprint::FromDimensions(int(header_.block_width_), int(header_.block_height_));
} }
std::string ASTCFile::GetFootprintString() const { std::string ASTCFile::GetFootprintString() const {

View File

@@ -90,7 +90,7 @@ bool DecompressToImage(const uint8_t* astc_data, size_t astc_data_size,
} }
uint8_t* pixel = out_row + px * kBytesPerPixelUNORM8; uint8_t* pixel = out_row + px * kBytesPerPixelUNORM8;
const RgbaColor decoded_color = logical_block.ColorAt(x, y); const RgbaColor decoded_color = logical_block.ColorAt(int(x), int(y));
for (size_t i = 0; i < kBytesPerPixelUNORM8; ++i) { for (size_t i = 0; i < kBytesPerPixelUNORM8; ++i) {
pixel[i] = static_cast<uint8_t>(decoded_color[i]); pixel[i] = static_cast<uint8_t>(decoded_color[i]);
} }

View File

@@ -79,7 +79,7 @@ void InvertBitTransferSigned(int* const a, int* const b) {
template<typename ContainerType> template<typename ContainerType>
void Quantize(ContainerType* const c, size_t max_value) { void Quantize(ContainerType* const c, size_t max_value) {
for (auto& x : *c) { for (auto& x : *c) {
x = QuantizeCEValueToRange(x, max_value); x = QuantizeCEValueToRange(x, int(max_value));
} }
} }
@@ -93,7 +93,7 @@ ArrayType QuantizeColor(const ArrayType& c, size_t max_value) {
template<typename ContainerType> template<typename ContainerType>
void Unquantize(ContainerType* const c, size_t max_value) { void Unquantize(ContainerType* const c, size_t max_value) {
for (auto& x : *c) { for (auto& x : *c) {
x = UnquantizeCEValueFromRange(x, max_value); x = UnquantizeCEValueFromRange(x, int(max_value));
} }
} }

View File

@@ -299,8 +299,8 @@ void EncodeISEBlock(const std::vector<int>& vals, int bits_per_val,
// We only need to add as many bits as necessary, so let's limit it based // We only need to add as many bits as necessary, so let's limit it based
// on the computation described in Section C.2.22 of the ASTC specification // on the computation described in Section C.2.22 of the ASTC specification
const int total_num_bits = const int total_num_bits =
((vals.size() * kNumEncodedBitsPerBlock + kNumVals - 1) / kNumVals) int(((vals.size() * kNumEncodedBitsPerBlock + kNumVals - 1) / kNumVals)
+ vals.size() * bits_per_val; + vals.size() * bits_per_val);
int bits_added = 0; int bits_added = 0;
// The number of bits used for the quint/trit encoding is necessary to know // The number of bits used for the quint/trit encoding is necessary to know

View File

@@ -214,7 +214,7 @@ int ExtraConfigBitPosition(const IntermediateBlockData& data) {
int extra_config_bits = 0; int extra_config_bits = 0;
if (!SharedEndpointModes(data)) { if (!SharedEndpointModes(data)) {
const int num_encoded_cem_bits = 2 + data.endpoints.size() * 3; const int num_encoded_cem_bits = 2 + int(data.endpoints.size()) * 3;
extra_config_bits = num_encoded_cem_bits - 6; extra_config_bits = num_encoded_cem_bits - 6;
} }
@@ -304,7 +304,7 @@ int EndpointRangeForBlock(const IntermediateBlockData& data) {
return kEndpointRange_ReturnInvalidWeightDims; return kEndpointRange_ReturnInvalidWeightDims;
} }
const int num_partitions = data.endpoints.size(); const int num_partitions = int(data.endpoints.size());
// Calculate the number of bits that we would write prior to getting to the // Calculate the number of bits that we would write prior to getting to the
// color endpoint data // color endpoint data
@@ -406,7 +406,7 @@ base::Optional<std::string> Pack(const IntermediateBlockData& data,
} }
// Next, we place the number of partitions minus one. // Next, we place the number of partitions minus one.
const int num_partitions = data.endpoints.size(); const int num_partitions = int(data.endpoints.size());
bit_sink.PutBits(num_partitions - 1, 2); bit_sink.PutBits(num_partitions - 1, 2);
// If we have more than one partition, then we also have a partition ID. // If we have more than one partition, then we also have a partition ID.

View File

@@ -60,7 +60,7 @@ Partition ComputePartition(const Footprint& footprint,
const IntermediateBlockData& block) { const IntermediateBlockData& block) {
if (block.partition_id) { if (block.partition_id) {
const int part_id = block.partition_id.value(); const int part_id = block.partition_id.value();
const size_t num_parts = block.endpoints.size(); const int num_parts = int(block.endpoints.size());
return GetASTCPartition(footprint, num_parts, part_id); return GetASTCPartition(footprint, num_parts, part_id);
} else { } else {
return GenerateSinglePartition(footprint); return GenerateSinglePartition(footprint);

View File

@@ -311,7 +311,7 @@ class BitQuantizationMap : public QuantizationMap {
} }
assert(num_unquantized_bits == TotalUnquantizedBits); assert(num_unquantized_bits == TotalUnquantizedBits);
unquantization_map_.push_back(unquantized); unquantization_map_.push_back(int(unquantized));
// Fill half of the quantization map with the previous value for bits // Fill half of the quantization map with the previous value for bits
// and the other half with the current value for bits // and the other half with the current value for bits