mirror of
https://github.com/golang/net.git
synced 2026-04-01 02:47:08 +09:00
x/net/ipv4: better wording for TODOs
LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/167450043
This commit is contained in:
@@ -100,7 +100,7 @@ func (h *Header) Marshal() ([]byte, error) {
|
||||
b[posTotalLen], b[posTotalLen+1] = byte(h.TotalLen>>8), byte(h.TotalLen)
|
||||
b[posFragOff], b[posFragOff+1] = byte(flagsAndFragOff>>8), byte(flagsAndFragOff)
|
||||
} else {
|
||||
// TODO(mikio): fix spurious word boundary access
|
||||
// TODO(mikio): fix potential misaligned memory access
|
||||
*(*uint16)(unsafe.Pointer(&b[posTotalLen : posTotalLen+1][0])) = uint16(h.TotalLen)
|
||||
*(*uint16)(unsafe.Pointer(&b[posFragOff : posFragOff+1][0])) = uint16(flagsAndFragOff)
|
||||
}
|
||||
@@ -142,12 +142,12 @@ func ParseHeader(b []byte) (*Header, error) {
|
||||
h.TotalLen = int(b[posTotalLen])<<8 | int(b[posTotalLen+1])
|
||||
h.FragOff = int(b[posFragOff])<<8 | int(b[posFragOff+1])
|
||||
} else {
|
||||
// TODO(mikio): fix spurious word boundary access
|
||||
// TODO(mikio): fix potential misaligned memory access
|
||||
h.TotalLen = int(*(*uint16)(unsafe.Pointer(&b[posTotalLen : posTotalLen+1][0])))
|
||||
if runtime.GOOS != "freebsd" || freebsdVersion < 1000000 {
|
||||
h.TotalLen += hdrlen
|
||||
}
|
||||
// TODO(mikio): fix spurious word boundary access
|
||||
// TODO(mikio): fix potential misaligned memory access
|
||||
h.FragOff = int(*(*uint16)(unsafe.Pointer(&b[posFragOff : posFragOff+1][0])))
|
||||
}
|
||||
h.Flags = HeaderFlags(h.FragOff&0xe000) >> 13
|
||||
|
||||
Reference in New Issue
Block a user