Skip to content

Commit ff45d5d

Browse files
iporsutgopherbot
authored andcommitted
encoding/json/internal/jsonflags: fix comment with wrong field name
Flags struct has field Values but in the comments use Value. Fix it to correct name Values. Change-Id: Ib47e62538599a788c69fda27a7e2a97b8cf73263 Reviewed-on: https://go-review.googlesource.com/c/go/+/701415 Reviewed-by: Joseph Tsai <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Auto-Submit: Joseph Tsai <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 861c90c commit ff45d5d

File tree

1 file changed

+4
-4
lines changed
  • src/encoding/json/internal/jsonflags

1 file changed

+4
-4
lines changed

src/encoding/json/internal/jsonflags/flags.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ func (dst *Flags) Join(src Flags) {
169169
// Copy over all source presence bits over to the destination (using OR),
170170
// then invert the source presence bits to clear out source value (using AND-NOT),
171171
// then copy over source value bits over to the destination (using OR).
172-
// e.g., dst := Flags{Presence: 0b_1100_0011, Value: 0b_1000_0011}
173-
// e.g., src := Flags{Presence: 0b_0101_1010, Value: 0b_1001_0010}
172+
// e.g., dst := Flags{Presence: 0b_1100_0011, Values: 0b_1000_0011}
173+
// e.g., src := Flags{Presence: 0b_0101_1010, Values: 0b_1001_0010}
174174
dst.Presence |= src.Presence // e.g., 0b_1100_0011 | 0b_0101_1010 -> 0b_110_11011
175175
dst.Values &= ^src.Presence // e.g., 0b_1000_0011 & 0b_1010_0101 -> 0b_100_00001
176176
dst.Values |= src.Values // e.g., 0b_1000_0001 | 0b_1001_0010 -> 0b_100_10011
@@ -182,7 +182,7 @@ func (fs *Flags) Set(f Bools) {
182182
// then set the presence for all the identifier bits (using OR),
183183
// then invert the identifier bits to clear out the values (using AND-NOT),
184184
// then copy over all the identifier bits to the value if LSB is 1.
185-
// e.g., fs := Flags{Presence: 0b_0101_0010, Value: 0b_0001_0010}
185+
// e.g., fs := Flags{Presence: 0b_0101_0010, Values: 0b_0001_0010}
186186
// e.g., f := 0b_1001_0001
187187
id := uint64(f) &^ uint64(1) // e.g., 0b_1001_0001 & 0b_1111_1110 -> 0b_1001_0000
188188
fs.Presence |= id // e.g., 0b_0101_0010 | 0b_1001_0000 -> 0b_1101_0011
@@ -207,7 +207,7 @@ func (fs Flags) Has(f Bools) bool {
207207
// The value bit of f (i.e., the LSB) is ignored.
208208
func (fs *Flags) Clear(f Bools) {
209209
// Invert f to produce a mask to clear all bits in f (using AND).
210-
// e.g., fs := Flags{Presence: 0b_0101_0010, Value: 0b_0001_0010}
210+
// e.g., fs := Flags{Presence: 0b_0101_0010, Values: 0b_0001_0010}
211211
// e.g., f := 0b_0001_1000
212212
mask := uint64(^f) // e.g., 0b_0001_1000 -> 0b_1110_0111
213213
fs.Presence &= mask // e.g., 0b_0101_0010 & 0b_1110_0111 -> 0b_0100_0010

0 commit comments

Comments
 (0)