mirror of
https://github.com/golang/go
synced 2024-11-19 12:34:47 -07:00
encoding/binary: returns length of bool slice in intDataSize
intDataSize should return length of bool slice, so functions Read and Write can use the fast path to process bool slice. Change-Id: I8cd275e3ffea82024850662d86caca64bd91bf70 Reviewed-on: https://go-review.googlesource.com/112135 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
6428c892c0
commit
5188b4dea0
@ -665,6 +665,8 @@ func intDataSize(data interface{}) int {
|
|||||||
switch data := data.(type) {
|
switch data := data.(type) {
|
||||||
case bool, int8, uint8, *bool, *int8, *uint8:
|
case bool, int8, uint8, *bool, *int8, *uint8:
|
||||||
return 1
|
return 1
|
||||||
|
case []bool:
|
||||||
|
return len(data)
|
||||||
case []int8:
|
case []int8:
|
||||||
return len(data)
|
return len(data)
|
||||||
case []uint8:
|
case []uint8:
|
||||||
|
Loading…
Reference in New Issue
Block a user