@@ -1312,7 +1312,7 @@ Op Builder::getMostBasicTypeClass(Id typeId) const
13121312 }
13131313}
13141314
1315- int Builder::getNumTypeConstituents (Id typeId) const
1315+ unsigned int Builder::getNumTypeConstituents (Id typeId) const
13161316{
13171317 Instruction* instr = module .getInstruction (typeId);
13181318
@@ -2924,7 +2924,7 @@ Id Builder::createLvalueSwizzle(Id typeId, Id target, Id source, const std::vect
29242924 swizzle->reserveOperands (2 );
29252925 swizzle->addIdOperand (target);
29262926
2927- assert (getNumComponents (source) == ( int ) channels.size ());
2927+ assert (getNumComponents (source) == channels.size ());
29282928 assert (isVector (source));
29292929 swizzle->addIdOperand (source);
29302930
@@ -3371,7 +3371,7 @@ Id Builder::createCompositeCompare(Decoration precision, Id value1, Id value2, b
33713371Id Builder::createCompositeConstruct (Id typeId, const std::vector<Id>& constituents)
33723372{
33733373 assert (isAggregateType (typeId) || (getNumTypeConstituents (typeId) > 1 &&
3374- getNumTypeConstituents (typeId) == ( int ) constituents.size ()));
3374+ getNumTypeConstituents (typeId) == constituents.size ()));
33753375
33763376 if (generatingOpCodeForSpecConst) {
33773377 // Sometime, even in spec-constant-op mode, the constant composite to be
@@ -3464,8 +3464,8 @@ Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sourc
34643464 if (sourcesToUse + targetComponent > numTargetComponents)
34653465 sourcesToUse = numTargetComponents - targetComponent;
34663466
3467- int col = 0 ;
3468- int row = 0 ;
3467+ unsigned int col = 0 ;
3468+ unsigned int row = 0 ;
34693469 for (unsigned int s = 0 ; s < sourcesToUse; ++s) {
34703470 if (row >= getNumRows (sourceArg)) {
34713471 row = 0 ;
@@ -3510,8 +3510,8 @@ Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sourc
35103510Id Builder::createMatrixConstructor (Decoration precision, const std::vector<Id>& sources, Id resultTypeId)
35113511{
35123512 Id componentTypeId = getScalarTypeId (resultTypeId);
3513- int numCols = getTypeNumColumns (resultTypeId);
3514- int numRows = getTypeNumRows (resultTypeId);
3513+ unsigned int numCols = getTypeNumColumns (resultTypeId);
3514+ unsigned int numRows = getTypeNumRows (resultTypeId);
35153515
35163516 Instruction* instr = module .getInstruction (componentTypeId);
35173517 const unsigned bitCount = instr->getImmediateOperand (0 );
@@ -3526,11 +3526,11 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
35263526 Id sourceColumnTypeId = getContainedTypeId (getTypeId (matrix));
35273527
35283528 std::vector<unsigned > channels;
3529- for (int row = 0 ; row < numRows; ++row)
3529+ for (unsigned int row = 0 ; row < numRows; ++row)
35303530 channels.push_back (row);
35313531
35323532 std::vector<Id> matrixColumns;
3533- for (int col = 0 ; col < numCols; ++col) {
3533+ for (unsigned int col = 0 ; col < numCols; ++col) {
35343534 std::vector<unsigned > indexes;
35353535 indexes.push_back (col);
35363536 Id colv = createCompositeExtract (matrix, sourceColumnTypeId, indexes);
@@ -3548,7 +3548,7 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
35483548
35493549 // Detect a matrix being constructed from a repeated vector of the correct size.
35503550 // Create the composite directly from it.
3551- if (( int ) sources.size () == numCols && isVector (sources[0 ]) && getNumComponents (sources[0 ]) == numRows &&
3551+ if (sources.size () == numCols && isVector (sources[0 ]) && getNumComponents (sources[0 ]) == numRows &&
35523552 std::equal (sources.begin () + 1 , sources.end (), sources.begin ())) {
35533553 return setPrecision (createCompositeConstruct (resultTypeId, sources), precision);
35543554 }
@@ -3580,12 +3580,12 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
35803580 } else if (isMatrix (sources[0 ])) {
35813581 // constructing from another matrix; copy over the parts that exist in both the argument and constructee
35823582 Id matrix = sources[0 ];
3583- int minCols = std::min (numCols, getNumColumns (matrix));
3584- int minRows = std::min (numRows, getNumRows (matrix));
3585- for (int col = 0 ; col < minCols; ++col) {
3583+ unsigned int minCols = std::min (numCols, getNumColumns (matrix));
3584+ unsigned int minRows = std::min (numRows, getNumRows (matrix));
3585+ for (unsigned int col = 0 ; col < minCols; ++col) {
35863586 std::vector<unsigned > indexes;
35873587 indexes.push_back (col);
3588- for (int row = 0 ; row < minRows; ++row) {
3588+ for (unsigned int row = 0 ; row < minRows; ++row) {
35893589 indexes.push_back (row);
35903590 ids[col][row] = createCompositeExtract (matrix, componentTypeId, indexes);
35913591 indexes.pop_back ();
@@ -3594,12 +3594,12 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
35943594 }
35953595 } else {
35963596 // fill in the matrix in column-major order with whatever argument components are available
3597- int row = 0 ;
3598- int col = 0 ;
3597+ unsigned int row = 0 ;
3598+ unsigned int col = 0 ;
35993599
3600- for (int arg = 0 ; arg < ( int ) sources.size () && col < numCols; ++arg) {
3600+ for (unsigned int arg = 0 ; arg < sources.size () && col < numCols; ++arg) {
36013601 Id argComp = sources[arg];
3602- for (int comp = 0 ; comp < getNumComponents (sources[arg]); ++comp) {
3602+ for (unsigned int comp = 0 ; comp < getNumComponents (sources[arg]); ++comp) {
36033603 if (getNumComponents (sources[arg]) > 1 ) {
36043604 argComp = createCompositeExtract (sources[arg], componentTypeId, comp);
36053605 setPrecision (argComp, precision);
@@ -3623,9 +3623,9 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
36233623 // make the column vectors
36243624 Id columnTypeId = getContainedTypeId (resultTypeId);
36253625 std::vector<Id> matrixColumns;
3626- for (int col = 0 ; col < numCols; ++col) {
3626+ for (unsigned int col = 0 ; col < numCols; ++col) {
36273627 std::vector<Id> vectorComponents;
3628- for (int row = 0 ; row < numRows; ++row)
3628+ for (unsigned int row = 0 ; row < numRows; ++row)
36293629 vectorComponents.push_back (ids[col][row]);
36303630 Id column = createCompositeConstruct (columnTypeId, vectorComponents);
36313631 setPrecision (column, precision);
@@ -3852,7 +3852,7 @@ void Builder::accessChainStore(Id rvalue, Decoration nonUniform, spv::MemoryAcce
38523852
38533853 // If a swizzle exists and is not full and is not dynamic, then the swizzle will be broken into individual stores.
38543854 if (accessChain.swizzle .size () > 0 &&
3855- getNumTypeComponents (getResultingAccessChainType ()) != ( int ) accessChain.swizzle .size () &&
3855+ getNumTypeComponents (getResultingAccessChainType ()) != accessChain.swizzle .size () &&
38563856 accessChain.component == NoResult) {
38573857 for (unsigned int i = 0 ; i < accessChain.swizzle .size (); ++i) {
38583858 accessChain.indexChain .push_back (makeUintConstant (accessChain.swizzle [i]));
@@ -4172,7 +4172,7 @@ void Builder::simplifyAccessChainSwizzle()
41724172{
41734173 // If the swizzle has fewer components than the vector, it is subsetting, and must stay
41744174 // to preserve that fact.
4175- if (getNumTypeComponents (accessChain.preSwizzleBaseType ) > ( int ) accessChain.swizzle .size ())
4175+ if (getNumTypeComponents (accessChain.preSwizzleBaseType ) > accessChain.swizzle .size ())
41764176 return ;
41774177
41784178 // if components are out of order, it is a swizzle
0 commit comments