aboutsummaryrefslogtreecommitdiff
path: root/src/encoding
diff options
context:
space:
mode:
authorWeerasak Chongnguluam <singpor@gmail.com>2025-09-06 21:51:37 +0700
committerGopher Robot <gobot@golang.org>2025-09-08 07:00:06 -0700
commitff45d5d53cd942cfeab6c47b8414502e6dce4870 (patch)
tree7ebd38a6473a39b5c41ba687054855e49286bcab /src/encoding
parent861c90c907db1129dcd1540eecd3c66b6309db7a (diff)
downloadgo-ff45d5d53cd942cfeab6c47b8414502e6dce4870.tar.xz
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 <joetsai@digital-static.net> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Joseph Tsai <joetsai@digital-static.net> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/encoding')
-rw-r--r--src/encoding/json/internal/jsonflags/flags.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/encoding/json/internal/jsonflags/flags.go b/src/encoding/json/internal/jsonflags/flags.go
index da13adff4d..a53dfe7985 100644
--- a/src/encoding/json/internal/jsonflags/flags.go
+++ b/src/encoding/json/internal/jsonflags/flags.go
@@ -169,8 +169,8 @@ func (dst *Flags) Join(src Flags) {
// Copy over all source presence bits over to the destination (using OR),
// then invert the source presence bits to clear out source value (using AND-NOT),
// then copy over source value bits over to the destination (using OR).
- // e.g., dst := Flags{Presence: 0b_1100_0011, Value: 0b_1000_0011}
- // e.g., src := Flags{Presence: 0b_0101_1010, Value: 0b_1001_0010}
+ // e.g., dst := Flags{Presence: 0b_1100_0011, Values: 0b_1000_0011}
+ // e.g., src := Flags{Presence: 0b_0101_1010, Values: 0b_1001_0010}
dst.Presence |= src.Presence // e.g., 0b_1100_0011 | 0b_0101_1010 -> 0b_110_11011
dst.Values &= ^src.Presence // e.g., 0b_1000_0011 & 0b_1010_0101 -> 0b_100_00001
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) {
// then set the presence for all the identifier bits (using OR),
// then invert the identifier bits to clear out the values (using AND-NOT),
// then copy over all the identifier bits to the value if LSB is 1.
- // e.g., fs := Flags{Presence: 0b_0101_0010, Value: 0b_0001_0010}
+ // e.g., fs := Flags{Presence: 0b_0101_0010, Values: 0b_0001_0010}
// e.g., f := 0b_1001_0001
id := uint64(f) &^ uint64(1) // e.g., 0b_1001_0001 & 0b_1111_1110 -> 0b_1001_0000
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 {
// The value bit of f (i.e., the LSB) is ignored.
func (fs *Flags) Clear(f Bools) {
// Invert f to produce a mask to clear all bits in f (using AND).
- // e.g., fs := Flags{Presence: 0b_0101_0010, Value: 0b_0001_0010}
+ // e.g., fs := Flags{Presence: 0b_0101_0010, Values: 0b_0001_0010}
// e.g., f := 0b_0001_1000
mask := uint64(^f) // e.g., 0b_0001_1000 -> 0b_1110_0111
fs.Presence &= mask // e.g., 0b_0101_0010 & 0b_1110_0111 -> 0b_0100_0010