diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp
index 6a7fbf4151f781b34efe323688073c7ac98492c4..535a7736818b846f70365e9d12a33b76fd6923ad 100644
--- a/source/Lib/CommonLib/TrQuant.cpp
+++ b/source/Lib/CommonLib/TrQuant.cpp
@@ -265,7 +265,7 @@ void TrQuant::fwdLfnstNxN( TCoeff* src, TCoeff* dst, const uint32_t mode, const
     trMat += trSize;
   }
 
-  ::memset( out, 0, ( trSize - zeroOutSize ) * sizeof( int ) );
+  std::fill_n( out, trSize - zeroOutSize, 0 );
 }
 
 void TrQuant::invLfnstNxN( TCoeff* src, TCoeff* dst, const uint32_t mode, const uint32_t index, const uint32_t size, int zeroOutSize, const int maxLog2TrDynamicRange )