// ZeroPad returns x with zeros appended to the end to the specified length.
// If len(x) >= length, x is returned, otherwise a new array is returned.
335896
func ZeroPad(x []complex128, length int) []complex128 {
	if len(x) >= length {
		return x
	}

	r := make([]complex128, length)
	copy(r, x)
	return r
}
149469
func pkcs7Unpad(data []byte, blockSize int) ([]byte, error) {
	if blockSize <= 0 {
		return nil, ErrInvalidBlockSize
	}
	if len(data)%blockSize != 0 || len(data) == 0 {
		return nil, ErrInvalidPKCS7Data
	}
	c := data[len(data)-1]
	n := int(c)
	if n == 0 || n > len(data) {
		return nil, ErrInvalidPKCS7Padding
	}
	for i := 0; i < n; i++ {
		if data[len(data)-n+i] != c {
			return nil, ErrInvalidPKCS7Padding
		}
	}
	return data[:len(data)-n], nil
}
1078930
func (a *DispatchKeyEventArgs) SetIsKeypad(isKeypad bool) *DispatchKeyEventArgs {
	a.IsKeypad = &isKeypad
	return a
}
413415
func oneTimePad(data, key []byte) {
	n := len(data)
	if n != len(key) {
		panic("Lengths of slices are not equal")
	}

	for i := 0; i < n; i++ {
		data[i] ^= key[i]
	}
}
133521
func canonicalPadding(b []byte) error {
	switch {
	case b[0]&0x80 == 0x80:
		return errNegativeValue
	case len(b) > 1 && b[0] == 0x00 && b[1]&0x80 != 0x80:
		return errExcessivelyPaddedValue
	default:
		return nil
	}
}
252832
func ZeroMemory(ctx context, name string, offset int, size uint, reg *register) string {
	chunk := uint(1)
	if size%8 == 0 {
		chunk = 8
	} else if size%4 == 0 {

		chunk = 4
	} else if size%2 == 0 {

		chunk = 2
	} else {

		chunk = 1
	}
	asm := ""
	if size/chunk == 0 {
		return asm
	}
	datatype := OpDataType{OP_DATA, InstrData{signed: false, size: chunk}, XMM_INVALID}
	mov := GetInstr(I_MOV, datatype)
	for i := uint(0); i < size/chunk; i++ {
		ioffset := int(i*chunk) + offset
		asm += instrImmMem(ctx, mov, 0, reg, name, ioffset)
	}
	return asm
}
1126355
func pad(M [][]int, power int) [][]int {
	newM := make([][]int, power)
	for i := 0; i < len(M); i++ {
		newM[i] = make([]int, power)
		copy(newM[i], M[i])
	}
	for i := len(M); i < power; i++ {
		newM[i] = make([]int, power)
	}
	return newM
}
722744
func pad(value string, length int) string {
	plen := length - len(value)
	if plen > 0 {
		return value + strings.Repeat(" ", plen)
	}
	return value
}
1027767
function zeroPad(array, length) {
  for (let i = array.length; i < length; i++) {
    array[i] = '0';
  }
}
589784
func (q *QueryStringQuery) FuzzyPrefixLength(fuzzyPrefixLength int) *QueryStringQuery {
	q.fuzzyPrefixLength = &fuzzyPrefixLength
	return q
}
776744
func (pw *Writer) WritePads(v uint) {
	nb := -pw.numBits & 7
	pw.bufBits |= uint64(v) << pw.numBits
	pw.numBits += nb
}
1140995
func ZeroOf(in interface{}) interface{} {
	if in == nil {
		return nil
	}

	return reflect.Zero(reflect.TypeOf(in)).Interface()
}
734095
func findMSBSetNonZero64(x uint64) int {
	val := []uint64{0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000, 0xFFFFFFFF00000000}
	shift := []uint64{1, 2, 4, 8, 16, 32}
	var msbPos uint64
	for i := 5; i >= 0; i-- {
		if x&val[i] != 0 {
			x >>= shift[i]
			msbPos |= shift[i]
		}
	}
	return int(msbPos)
}
457534
func CountLeadZero64(value uint64) (uint) {
    var count uint = 0

    if (value >> 32) == 0 {
        count += 32
    } else {
        value >>= 32;
    }

    return count + CountLeadZero32(uint32(value))
}
225430
func zeroFill(w io.Writer, n int64) error {
	const blocksize = 32 << 10
	zeros := make([]byte, blocksize)
	var k int
	var err error
	for n > 0 {
		if n > blocksize {
			k, err = w.Write(zeros)
			if err != nil {
				return err
			}

		} else {
			k, err = w.Write(zeros[:n])
			if err != nil {
				return err
			}

		}
		if err != nil {
			return err
		}
		n -= int64(k)
	}
	return nil
}
1075294
def zero_pad(matrix, to_length):
    

    assert matrix.shape[0] <= to_length
    if not matrix.shape[0] <= to_length:
        logger.error("zero_pad cannot be performed on matrix with shape {}"
                     " to length {}".format(matrix.shape[0], to_length))
        raise ValueError
    result = np.zeros((to_length,) + matrix.shape[1:])
    result[:matrix.shape[0]] = matrix
    return result
1229706
func paddedAppend(size uint, dst, src []byte) []byte {
	for i := 0; i < int(size)-len(src); i++ {
		dst = append(dst, 0)
	}
	return append(dst, src...)
}