@@ -105,15 +105,15 @@ using namespace nvinfer1;
105105#undef CHECK
106106#define CHECK (status ) CHECK_WITH_STREAM(status, std::cerr)
107107
108- constexpr long double operator " " _GiB(long double val)
108+ constexpr long double operator " " _GiB(long double val)
109109{
110110 return val * (1 << 30 );
111111}
112- constexpr long double operator " " _MiB(long double val)
112+ constexpr long double operator " " _MiB(long double val)
113113{
114114 return val * (1 << 20 );
115115}
116- constexpr long double operator " " _KiB(long double val)
116+ constexpr long double operator " " _KiB(long double val)
117117{
118118 return val * (1 << 10 );
119119}
@@ -536,28 +536,28 @@ inline size_t getNbBytes(nvinfer1::DataType t, int64_t vol) noexcept
536536{
537537 switch (t)
538538 {
539- case nvinfer1::DataType::kINT64 : return 8 * vol;
539+ case nvinfer1::DataType::kINT64 : return static_cast < size_t >( 8 * vol) ;
540540 case nvinfer1::DataType::kINT32 :
541- case nvinfer1::DataType::kFLOAT : return 4 * vol;
541+ case nvinfer1::DataType::kFLOAT : return static_cast < size_t >( 4 * vol) ;
542542 case nvinfer1::DataType::kBF16 :
543- case nvinfer1::DataType::kHALF : return 2 * vol;
543+ case nvinfer1::DataType::kHALF : return static_cast < size_t >( 2 * vol) ;
544544 case nvinfer1::DataType::kBOOL :
545545 case nvinfer1::DataType::kUINT8 :
546- case nvinfer1::DataType::kINT8 : return vol;
546+ case nvinfer1::DataType::kINT8 : return static_cast < size_t >( vol) ;
547547 case nvinfer1::DataType::kFP8 :
548548#if CUDA_VERSION < 11060
549549 ASSERT (false && " FP8 is not supported" );
550550#else
551- return vol;
551+ return static_cast < size_t >( vol) ;
552552#endif
553553 case nvinfer1::DataType::kE8M0 :
554554#if CUDA_VERSION < 12080
555555 ASSERT (false && " E8M0 is not supported" );
556556#else
557- return vol;
557+ return static_cast < size_t >( vol) ;
558558#endif // CUDA_VERSION < 12080
559559 case nvinfer1::DataType::kINT4 :
560- case nvinfer1::DataType::kFP4 : return ( vol + 1 ) / 2 ;
560+ case nvinfer1::DataType::kFP4 : return static_cast < size_t >(( vol + 1 ) / 2 ) ;
561561 }
562562 ASSERT (false && " Unknown element type" );
563563}
@@ -759,25 +759,25 @@ inline void writePPMFileWithBBox(const std::string& filename, vPPM ppm, std::vec
759759 for (int x = int (bbox.x1 ); x < int (bbox.x2 ); ++x)
760760 {
761761 // bbox top border
762- ppm.buffer [( round (bbox.y1 ) * ppm.w + x) * 3 ] = 255 ;
763- ppm.buffer [( round (bbox.y1 ) * ppm.w + x) * 3 + 1 ] = 0 ;
764- ppm.buffer [( round (bbox.y1 ) * ppm.w + x) * 3 + 2 ] = 0 ;
762+ ppm.buffer [static_cast < size_t >(( round (bbox.y1 ) * ppm.w + x) * 3 ) ] = 255 ;
763+ ppm.buffer [static_cast < size_t >(( round (bbox.y1 ) * ppm.w + x) * 3 + 1 ) ] = 0 ;
764+ ppm.buffer [static_cast < size_t >(( round (bbox.y1 ) * ppm.w + x) * 3 + 2 ) ] = 0 ;
765765 // bbox bottom border
766- ppm.buffer [( round (bbox.y2 ) * ppm.w + x) * 3 ] = 255 ;
767- ppm.buffer [( round (bbox.y2 ) * ppm.w + x) * 3 + 1 ] = 0 ;
768- ppm.buffer [( round (bbox.y2 ) * ppm.w + x) * 3 + 2 ] = 0 ;
766+ ppm.buffer [static_cast < size_t >(( round (bbox.y2 ) * ppm.w + x) * 3 ) ] = 255 ;
767+ ppm.buffer [static_cast < size_t >(( round (bbox.y2 ) * ppm.w + x) * 3 + 1 ) ] = 0 ;
768+ ppm.buffer [static_cast < size_t >(( round (bbox.y2 ) * ppm.w + x) * 3 + 2 ) ] = 0 ;
769769 }
770770
771771 for (int y = int (bbox.y1 ); y < int (bbox.y2 ); ++y)
772772 {
773773 // bbox left border
774- ppm.buffer [( y * ppm.w + round (bbox.x1 )) * 3 ] = 255 ;
775- ppm.buffer [( y * ppm.w + round (bbox.x1 )) * 3 + 1 ] = 0 ;
776- ppm.buffer [( y * ppm.w + round (bbox.x1 )) * 3 + 2 ] = 0 ;
774+ ppm.buffer [static_cast < size_t >(( y * ppm.w + round (bbox.x1 )) * 3 ) ] = 255 ;
775+ ppm.buffer [static_cast < size_t >(( y * ppm.w + round (bbox.x1 )) * 3 + 1 ) ] = 0 ;
776+ ppm.buffer [static_cast < size_t >(( y * ppm.w + round (bbox.x1 )) * 3 + 2 ) ] = 0 ;
777777 // bbox right border
778- ppm.buffer [( y * ppm.w + round (bbox.x2 )) * 3 ] = 255 ;
779- ppm.buffer [( y * ppm.w + round (bbox.x2 )) * 3 + 1 ] = 0 ;
780- ppm.buffer [( y * ppm.w + round (bbox.x2 )) * 3 + 2 ] = 0 ;
778+ ppm.buffer [static_cast < size_t >(( y * ppm.w + round (bbox.x2 )) * 3 ) ] = 255 ;
779+ ppm.buffer [static_cast < size_t >(( y * ppm.w + round (bbox.x2 )) * 3 + 1 ) ] = 0 ;
780+ ppm.buffer [static_cast < size_t >(( y * ppm.w + round (bbox.x2 )) * 3 + 2 ) ] = 0 ;
781781 }
782782 }
783783
0 commit comments