Commit 3064e1c1 authored by Mikio Hara's avatar Mikio Hara

x/net/ipv4: better wording for TODOs

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/167450043
parent 5af45f39
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment