From 5188b4dea0614a15caa729d3c3153e1128e55f80 Mon Sep 17 00:00:00 2001 From: Joe Kyo Date: Tue, 8 May 2018 21:00:36 +0800 Subject: [PATCH] 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 Run-TryBot: Ian Lance Taylor --- src/encoding/binary/binary.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/encoding/binary/binary.go b/src/encoding/binary/binary.go index 22fd7f2a80..85b3bc2295 100644 --- a/src/encoding/binary/binary.go +++ b/src/encoding/binary/binary.go @@ -665,6 +665,8 @@ func intDataSize(data interface{}) int { switch data := data.(type) { case bool, int8, uint8, *bool, *int8, *uint8: return 1 + case []bool: + return len(data) case []int8: return len(data) case []uint8: -- 2.48.1