Question about some pieces of codes

>     func GetRequiredPadding(oldLength abi.PaddedPieceSize, newPieceLength abi.PaddedPieceSize) ([]abi.PaddedPieceSize, abi.PaddedPieceSize) {
> 
>     	padPieces := make([]abi.PaddedPieceSize, 0)
> 
>     	toFill := uint64(-oldLength % newPieceLength)
> 
>     	n := bits.OnesCount64(toFill)
>     	var sum abi.PaddedPieceSize
>     	for i := 0; i < n; i++ {
>     		next := bits.TrailingZeros64(toFill)
>     		psize := uint64(1) << uint(next)
>     		toFill ^= psize
> 
>     		padded := abi.PaddedPieceSize(psize)
>     		padPieces = append(padPieces, padded)
>     		sum += padded
>     	}
> 
>     	return padPieces, sum
>     }

Maybe it’s a very basic question. Could you help to tell what this function work for Actually I don’t understand it. Thanks for your help

Function comes from: extern/sector-storage/ffiwrapper/sealer_cgo.go