From: Russ Cox Date: Thu, 24 May 2012 18:50:36 +0000 (-0400) Subject: exp/locale/collate: avoid 16-bit math X-Git-Tag: go1.1rc2~3119 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ce69666273bab23b5b4597acb4dbd1c18aba7270;p=gostls13.git exp/locale/collate: avoid 16-bit math There's no need for the 16-bit arithmetic here, and it tickles a long-standing compiler bug. Fix the exp code not to use 16-bit math and create an explicit test for the compiler bug. R=golang-dev, r CC=golang-dev https://golang.org/cl/6256048 --- diff --git a/src/pkg/exp/locale/collate/colelem.go b/src/pkg/exp/locale/collate/colelem.go index 1d66392f94..c867fdac69 100644 --- a/src/pkg/exp/locale/collate/colelem.go +++ b/src/pkg/exp/locale/collate/colelem.go @@ -102,7 +102,7 @@ const ( ) func splitContractIndex(ce colElem) (index, n, offset int) { - h := uint16(ce) + h := ce & 0xffff return int(h >> maxNBits), int(h & (1<>16) & (1<>5) || n != int(c & (1<<5-1)) || offset != (c>>16)&(1<<14-1) { + println("BUG", index, n, offset) + } +} + +func splitContractIndex(ce uint32) (index, n, offset int) { + h := uint16(ce) + return int(h >> 5), int(h & (1<<5 - 1)), int(ce>>16) & (1<<14 - 1) +}