I'm confused about the time package nsec() function operation. It's applying the AND operator on the wall property of the time & nanosecond mask (which is 1<<30-1 => 111111111111111111111111111111) to return the nanosecond value of the time object. I'm wondering that ANDING a number with 1<<30-1 equals the number (because all digits have value 1), so why they're doing it?
func (t *Time) nsec() int32 {
return int32(t.wall & nsecMask)
}
The main source code: https://cs.opensource.google/go/go/+/refs/tags/go1.16.7:src/time/time.go;l=164;drc=refs%2Ftags%2Fgo1.16.7