func (c *peCheckSum) Write(p []byte) (int, error) {
	l := uint32(len(p))
	o := c.size & 1
	m := (l-o)&^1 + o
	if o != 0 && l != 0 {
		c.sum = add16c(c.sum, uint32(p[0])<<8|c.rem)
	}
	for i := o; i < m; i += 2 {
		c.sum = add16c(c.sum, uint32(p[i+1])<<8|uint32(p[i]))
	}
	if m < l {
		c.rem = uint32(p[m])
	}
	c.size += l
	return len(p), nil
}
// Write implements the Writer interface to compute the
// PE checksum of a PE file.
//
// That file must have its CheckSum field set to zero.
Write implements the Writer interface to compute the
PE checksum of a PE file.

That file must have its CheckSum field set to zero.
// Write implements the Writer interface to compute the // PE checksum of a PE file . // // That file must have its CheckSum field set to zero .
func (c *peCheckSum) Write(p []byte) (int, error) {
	l := uint32(len(p))
	o := c.size & 1
	m := (l-o)&^1 + o
	if o != 0 && l != 0 {
		c.sum = add16c(c.sum, uint32(p[0])<<8|c.rem)
	}
	for i := o; i < m; i += 2 {
		c.sum = add16c(c.sum, uint32(p[i+1])<<8|uint32(p[i]))
	}
	if m < l {
		c.rem = uint32(p[m])
	}
	c.size += l
	return len(p), nil
}
func ( c * peCheckSum ) Write ( p [ ] byte ) ( int , error ) { l := uint32 ( len ( p ) ) o := c . size & 1 m := ( l - o ) &^ 1 + o if o != 0 && l != 0 { c . sum = add16c ( c . sum , uint32 ( p [ 0 ] ) << 8 | c . rem ) } for i := o ; i < m ; i += 2 { c . sum = add16c ( c . sum , uint32 ( p [ i + 1 ] ) << 8 | uint32 ( p [ i ] ) ) } if m < l { c . rem = uint32 ( p [ m ] ) } c . size += l return len ( p ) , nil }
Write implements the Writer interface to compute the
PE checksum of a PE file.
Write implements the Writer interface to compute the PE checksum of a PE file .