1
0
mirror of https://github.com/golang/go synced 2024-10-02 00:18:32 -06: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:
Joe Kyo 2018-05-08 21:00:36 +08:00 committed by Ian Lance Taylor
parent 6428c892c0
commit 5188b4dea0

View File

@ -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: