Skip to content

Commit 56dca65

Browse files
authored
bugfix: false value has incorrect encoding value - invert flag and value (#22)
1 parent 25800f6 commit 56dca65

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

typeddata/typeddata.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func Encode(data interface{}, buf []byte) ([]byte, int, error) {
5151
case bool:
5252
var b byte = 0x11
5353
if !v {
54-
b = 0x10
54+
b = 0x01
5555
}
5656
buf = append(buf, b)
5757
return buf, 1, nil

typeddata/typeddata_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestEncode_Bool(t *testing.T) {
3232
if len(buf) != 1 {
3333
t.Fatalf("buf len must be 1, got %d", len(buf))
3434
}
35-
if buf[0] != 0x10 {
35+
if buf[0] != 0x01 {
3636
t.Fatalf("invalid buf value")
3737
}
3838

0 commit comments

Comments
 (0)